Thread overview
[Issue 9144] New: synchronized CRITSECSIZE should be a target constant
Dec 11, 2012
dawg@dawgfoto.de
Dec 12, 2012
Iain Buclaw
Dec 12, 2012
Martin Nowak
May 22, 2013
Martin Nowak
December 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9144

           Summary: synchronized CRITSECSIZE should be a target constant
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dawg@dawgfoto.de


--- Comment #0 from dawg@dawgfoto.de 2012-12-11 15:27:50 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9144


Iain Buclaw <ibuclaw@ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@ubuntu.com


--- Comment #1 from Iain Buclaw <ibuclaw@ubuntu.com> 2012-12-11 17:56:01 PST ---
Speaking of target constants.  There should be target hooks for this sort of stuff to allow different backends to implement their own value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9144



--- Comment #2 from Martin Nowak <code@dawg.eu> 2012-12-11 23:12:05 PST ---
>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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9144


Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from Martin Nowak <code@dawg.eu> 2013-05-22 13:50:22 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2060 https://github.com/D-Programming-Language/dmd/commit/f8669e6c38d5e03757aeabe2a29a8e76d75c7baf

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------