www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15577] New: -profile and atomicOp segfaults

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

          Issue ID: 15577
           Summary: -profile and atomicOp segfaults
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

Compiling the following code with -profile. When running the binary it will
result in a segmentation fault. Seems to only happen when "foo" is ulong. It
occurs with DMD 2.070.0-b2 and several older versions.

import core.atomic;

shared ulong foo;

void main()
{
    atomicOp!"+="(foo, 1);
}

Debugger session:

$ lldb main
(lldb) target create "main"
Current executable set to 'main' (x86_64).
(lldb) r
Process 97890 launched: '/Users/jacob/development/d/main' (x86_64)
Process 97890 stopped

main`D2rt12sections_osx9tlsOffsetFPvZm + 90, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

main`D2rt12sections_osx9tlsOffsetFPvZm:
->  0x100022e2e <+90>: hlt
    0x100022e2f <+91>: nop

main`sections_osx_onAddImage:
    0x100022e30 <+0>:  pushq  %rbp
    0x100022e31 <+1>:  movq   %rsp, %rbp
(lldb) bt

main`D2rt12sections_osx9tlsOffsetFPvZm + 90, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)




main`D4core6atomic24__T14atomicFetchAddTmTiZ14atomicFetchAddFNaNbNiKOmiZm + 44
at atomic.d:657


main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 14

main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 56





--
Jan 18 2016