[LLVMbugs] [Bug 14064] New: segfault in destructor of aggregate struct in statically initialized global array

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 11 03:46:47 PDT 2012


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

             Bug #: 14064
           Summary: segfault in destructor of aggregate struct in
                    statically initialized global array
           Product: new-bugs
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: riccardi at systran.fr
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


struct foo
{
  ~foo()
  {
    if (str)
    {}
  }
  const char* str;
  bool ok;
};

foo foos[] = {
  { "test", 0 }
};

int main()
{
  return 0;
}

$ clang++ -v
Debian clang version 3.1-4ppa3 (branches/release_31) (based on LLVM 3.1)
Target: x86_64-pc-linux-gnu
Thread model: posix

This segfaults in ~foo with an obviously invalid 'this':

Program received signal SIGSEGV, Segmentation fault.
foo::~foo (this=0x2460b540) at test.cpp:8
8        if (str)
(gdb) p &foos[0]
$2 = (foo *) 0x601050


I also reproduce it on MacOS with the Apple version:
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

-- 
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.



More information about the llvm-bugs mailing list