[LLVMbugs] [Bug 15519] New: Bad instruction crash in built code, using -fsanitize=undefined-trap with libstdc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 14 18:33:12 PDT 2013


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

            Bug ID: 15519
           Summary: Bad instruction crash in built code, using
                    -fsanitize=undefined-trap with libstdc++
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bugzilla at jwwalker.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Overview: Building certain code with the flags
-fsanitize-undefined-trap-on-error -fsanitize=undefined-trap and using
libstdc++ produces a bad instruction error at run time.


Steps to Reproduce:

1. Create a main.cpp file containing this code:
#include <iostream>
int main(int argc, const char * argv[])
{
  std::cout.setf( std::ios::hex, std::ios::basefield );
  return 0;
}

2. Compile:
clang -arch i386 -stdlib=libstdc++ -fsanitize-undefined-trap-on-error
-fsanitize=undefined-trap -c main.cpp -o main.o

3. Link:
clang++ -arch i386 -stdlib=libstdc++ main.o

4. Execute:
./a.out


Actual Results:

There is a bad instruction crash in ios_base.h.  Backtrace:

0   a.out                             0x000c17f9
std::operator&=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags) + 57
1   a.out                             0x000c16d6
std::ios_base::setf(std::_Ios_Fmtflags, std::_Ios_Fmtflags) + 342
2   a.out                             0x000c1406 main + 134
3   a.out                             0x000c1375 start + 53


Expected Results:

No error and no output.


Build version and platform:

clang version 3.3 (trunk 177113)
Mac OS X 10.7.5 with Xcode 4.6


Additional Information:

When using libc++ instead of libstdc++, the crash does not occur.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130315/61f87bd3/attachment.html>


More information about the llvm-bugs mailing list