[LLVMbugs] [Bug 6795] New: clang/opt -O2 makes re2c crash on startup

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 6 07:14:06 PDT 2010


           Summary: clang/opt -O2 makes re2c crash on startup
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=4647)
 --> (http://llvm.org/bugs/attachment.cgi?id=4647)

When compiling re2c with clang++ -O2 it crashes on startup like this:
#0  0x00000038ea66ae39 in std::locale::operator=(std::locale const&) () from
#1  0x00000038ea66a37f in std::ios_base::_M_init() () from
#2  0x00000038ea67b199 in std::basic_ios<char, std::char_traits<char>
>::init(std::basic_streambuf<char, std::char_traits<char
> >*) () from /usr/lib/libstdc++.so.6
#3  0x000000000041c349 in re2c::basic_ifstream_lc<char, std::char_traits<char>
>::basic_ifstream_lc() ()
#4  0x000000000041a99a in main () at main.cc:394

To reproduce: compile re2c with clang++ -O2, and run ./re2c foo

Small C++ testcase, crashes on startup with clang++ -O2, but not with clang++
-O1 or -O0:
#include <fstream>
using namespace std;
typedef unsigned int uint;
    class _BaseStream>
class basic_fstream_lc
    : public _BaseStream

    virtual ~basic_fstream_lc()

    uint get_line() const

    mutable void *mybuf;
class basic_ifstream_lc
    : public basic_fstream_lc<std::basic_istream<char> >
int main()
    class basic_ifstream_lc source;

Program received signal SIGSEGV, Segmentation fault.
0x0000003b3a475989 in *__GI___libc_free (mem=<value optimized out>) at
3724    malloc.c: No such file or directory.
        in malloc.c
(gdb) bt
#0  0x0000003b3a475989 in *__GI___libc_free (mem=<value optimized out>) at
#1  0x00000038ea6694bb in std::ios_base::~ios_base() () from
#2  0x0000000000400c82 in main () at foo.cc:30

Attaching bugpoint reduced testcase:
*** Found miscompiling pass: -inline
Emitted bitcode to 'bugpoint-passinput.bc'

*** You can reproduce the problem with: opt bugpoint-passinput.bc -inline

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