[LLVMbugs] [Bug 7520] New: clang: SemaExprCXX.cpp:2641: clang::Expr* clang::Sema::MaybeCreateCXXExprWithTemporaries(clang::Expr*): Assertion `SubExpr && "sub expression can't be null!"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 29 07:04:50 PDT 2010


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

           Summary: clang: SemaExprCXX.cpp:2641: clang::Expr*
                    clang::Sema::MaybeCreateCXXExprWithTemporaries(clang::
                    Expr*): Assertion `SubExpr && "sub expression can't be
                    null!"' failed.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jan.allmyspam at gmail.com
                CC: llvmbugs at cs.uiuc.edu


I've found a problem with an some code from an open source project that
compiles fine with gcc but triggers the above assertion in clang. 

clang -c demo.cpp
clang: SemaExprCXX.cpp:2641: clang::Expr*
clang::Sema::MaybeCreateCXXExprWithTemporaries(clang::Expr*): Assertion
`SubExpr && "sub expression can't be null!"' failed.
0  clang           0x000000000158b374
1  clang           0x000000000158b238
2  libpthread.so.0 0x00007f9c28b698f0
3  libc.so.6       0x00007f9c27e59a75 gsignal + 53
4  libc.so.6       0x00007f9c27e5d5c0 abort + 384
5  libc.so.6       0x00007f9c27e52941 __assert_fail + 241
6  clang           0x000000000078403d
7  clang           0x00000000007841f4
8  clang           0x0000000000706f3a
9  clang           0x0000000000705e6a
10 clang           0x0000000000ae591f
11 clang           0x0000000000ae539c
12 clang           0x0000000000b00591
13 clang           0x0000000000ae5217
14 clang           0x0000000000ae2ec6
15 clang           0x0000000000ad739c
16 clang           0x0000000000afc48c
17 clang           0x0000000000afc2e6
18 clang           0x0000000000afbe5b
19 clang           0x0000000000ad3f0e
20 clang           0x0000000000ace2c4
21 clang           0x0000000000acdc75
22 clang           0x000000000069cce8
23 clang           0x000000000045224e
24 clang           0x000000000055c230
25 clang           0x0000000000451eae
26 clang           0x000000000043bd38
27 clang           0x000000000040946e
28 clang           0x0000000000412220 main + 357
29 libc.so.6       0x00007f9c27e44c4d __libc_start_main + 253
30 clang           0x0000000000407e09
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name demo.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -resource-dir /usr/local/lib/clang/2.0
-ferror-limit 19 -fmessage-length 209 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-T6I4dN.s -x c++
demo.cpp 
1.    demo.cpp:10:5: current parser token '{'
2.    demo.cpp:4:1: parsing struct/union/class body 'Map'
clang: error: clang frontend command failed due to signal 6 (use -v to see
invocation)

clang --version
clang version 2.0 (trunk 106853)
Target: x86_64-unknown-linux-gnu
Thread model: posix

A code fragment that provokes this is shown below. The problem seems to be the
initialization of the resolutions array in the constructor ("resolutions()"). I
don't know what this should do but it compiles on GCC and I guess clang should
give a warning/error message instead of the assertion.

Here is an example, demo.cpp:
#include <vector>

template<std::size_t dims>
class Map
{
public:

    Map() :
        resolutions()
    {}

private:
    double resolutions[dims];
};

typedef Map<2> Map2D;

Cheers
Jan

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