[Issue 11435] -O optimization flag causes invalid codegen

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 26 21:45:33 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=11435

safety0ff.bugz <safety0ff.bugz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Nondeterministic 32bit      |-O optimization flag causes
                   |release mode access         |invalid codegen
                   |violation                   |
           Severity|normal                      |critical

--- Comment #5 from safety0ff.bugz <safety0ff.bugz at gmail.com> ---
I've managed to reduce it to a test that consistently fails.
The reduced test case is posix only (posix with MAP_ANON extension,) but the
bug manifests itself on all 32 bit x86 platforms.

Disassembly snippet:
Here is part of the loop in S.foo(), DMD creates a 4 byte read on <+85>, but it
is only valid to read one byte. This causes the segfault.
ebx is the loop index and ecx is the pointer to the array.
   <+80>:    mov    -0x4(%ebp),%ecx
   <+83>:    mov    %esi,%eax
=> <+85>:    pushl  (%ebx,%ecx,1)
   <+88>:    push   %ebx
   <+89>:    call   0x8070f70 <_D6_114351S13opIndexAssignMFbkZb>
   <+94>:    inc    %ebx
   <+95>:    cmp    0x8(%ebp),%ebx
   <+98>:    jb     0x8070f41 <_D6_114351S3fooMFAbZv+65>

--


More information about the Digitalmars-d-bugs mailing list