http://llvm.org/bugs/show_bug.cgi?id=9593

           Summary: static dtors are invoked unconditionally with
                    -fno-use-cxa-atexit
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
            Blocks: 8390


Created an attachment (id=6383)
 --> (http://llvm.org/bugs/attachment.cgi?id=6383)
foo.s generated by clang -fno-use-cxa-atexit

// testcase
extern "C" void ctor();
extern "C" void dtor();

class FOO {
public:
  FOO()  {ctor();}
  ~FOO() {dtor();}
};

FOO* get() {
  static FOO instance;
  return &instance;
}

$ clang++ -cc1 -fno-use-cxa-atexit -O3 -Wall foo.cc -S -emit-llvm -o foo.ll

  (snip)

define %class.FOO* @_Z3getv() nounwind {
  (check and set guard variable for get()::instance)
}

  (snip)

@llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()*
@_GLOBAL__D_a }]

  (snip)

define internal void @_GLOBAL__D_a() nounwind {
entry:
  tail call void @dtor() nounwind
  ret void
}

////////

Cygming is affected by this issue.
FYI, with g++-4.4 on cygming, atexit(tcf_xxx) is used instead of cxa_atexit.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to