Bug 9144 – synchronized CRITSECSIZE should be a target constant

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-11T15:27:00Z
Last change time
2015-06-09T05:11:52Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2012-12-11T15:27:50Z
In statement.c the compiler defines CRITSECSIZE to be the size of a critical section. This is done using the HOST system headers and sizeof. During cross compilation this may lead to memory corruptions when the size of a critical section is smaller on the host system than it is on the target. This is already the case for Linux 32/64 (32 vs. 40 byte). I found this bug by tracking down a memory corruption using a mipsel-linux-gdc cross compiler.
Comment #1 by ibuclaw — 2012-12-11T17:56:01Z
Speaking of target constants. There should be target hooks for this sort of stuff to allow different backends to implement their own value.
Comment #2 by code — 2012-12-11T23:12:05Z
>There should be target hooks Yeah there should be hooks for target constants. For this I think we should expose a critical section struct through the druntime/compiler interface. It's effectively a runtime issue to do the locking so it should choose the means. I'll prepare a pull request.
Comment #3 by code — 2013-05-22T13:50:22Z