[cfe-dev] Bug (Regression) in clang trunk

Fabio Fracassi f.fracassi at gmx.net
Fri Mar 2 10:19:54 PST 2012


Hello,

when compiling this code with today's trunk (r151919) clang (on Snow 
Leopard) crashes with an Assertion. It worked before (version form some 
month back). Anyone seen this or shall I file a bug?

Regards

Fabio

#include <boost/type_traits/is_const.hpp>  // from boost 1.46.1

template <typename Type>
struct Foo {
    bool isConst() const { return boost::is_const<Type>::value; }
};

struct Test {};

int main () {
    Foo<Test> h;
    bool b = h.isConst();
}

The output is:
/usr/local/bin/clang++ -v -I /usr/local/include/boost-1_46_1/ 
clang_crash.cpp  clang version 3.1 (trunk 151919)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
  "/usr/local/bin/clang-3.0" -cc1 -triple x86_64-apple-macosx10.6.0 
-emit-obj -mrelax-all -disable-free -main-file-name clang_crash.cpp 
-pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu 
core2 -v -resource-dir /usr/local/bin/../lib/clang/3.1 -I 
/usr/local/include/boost-1_46_1/ -fmodule-cache-path 
/var/folders/nG/nGiPDqRHGemu91F8AhkN2++++TI/-Tmp-/clang-module-cache 
-fdeprecated-macro -fdebug-compilation-dir 
/Users/fabio/Development/Playground -ferror-limit 19 -fmessage-length 
128 -stack-protector 1 -mstackrealign -fblocks 
-fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions 
-fdiagnostics-show-option -fcolor-diagnostics -o 
/var/folders/nG/nGiPDqRHGemu91F8AhkN2++++TI/-Tmp-/clang_crash-yeZWUT.o 
-x c++ clang_crash.cpp
clang -cc1 version 3.1 based upon LLVM 3.1svn default target 
x86_64-apple-darwin10.8.0
#include "..." search starts here:
#include <...> search starts here:
  /usr/local/include/boost-1_46_1
  /usr/include/c++/4.2.1
  /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64
  /usr/include/c++/4.2.1/backward
  /usr/include/c++/4.0.0
  /usr/include/c++/4.0.0/i686-apple-darwin8
  /usr/include/c++/4.0.0/backward
  /usr/local/include
  /usr/local/bin/../lib/clang/3.1/include
  /usr/include
  /System/Library/Frameworks (framework directory)
  /Library/Frameworks (framework directory)
End of search list.
Assertion failed: (getOperand(0)->getType() == 
cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr 
must be a pointer to Val type!"), function AssertOK, file 
/Users/fabio/Development/LLVM/llvm/lib/VMCore/Instructions.cpp, line 1056.
Stack dump:
0.    Program arguments: /usr/local/bin/clang-3.0 -cc1 -triple 
x86_64-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free 
-main-file-name clang_crash.cpp -pic-level 1 -mdisable-fp-elim 
-masm-verbose -munwind-tables -target-cpu core2 -v -resource-dir 
/usr/local/bin/../lib/clang/3.1 -I /usr/local/include/boost-1_46_1/ 
-fmodule-cache-path 
/var/folders/nG/nGiPDqRHGemu91F8AhkN2++++TI/-Tmp-/clang-module-cache 
-fdeprecated-macro -fdebug-compilation-dir 
/Users/fabio/Development/Playground -ferror-limit 19 -fmessage-length 
128 -stack-protector 1 -mstackrealign -fblocks 
-fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions 
-fdiagnostics-show-option -fcolor-diagnostics -o 
/var/folders/nG/nGiPDqRHGemu91F8AhkN2++++TI/-Tmp-/clang_crash-yeZWUT.o 
-x c++ clang_crash.cpp
1. <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    clang_crash.cpp:5:9: Generating code for declaration 
'Foo<Test>::isConst'
4.    clang_crash.cpp:5:25: LLVM IR generation of compound statement ('{}')
clang-3: error: unable to execute command: Illegal instruction
clang-3: error: clang frontend command failed due to signal (use -v to 
see invocation)
clang-3: note: diagnostic msg: Please submit a bug report to 
http://llvm.org/bugs/ and include command line arguments and all 
diagnostic information.
clang-3: note: diagnostic msg: Preprocessed source(s) and associated run 
script(s) are located at:
clang-3: note: diagnostic msg: 
/var/folders/nG/nGiPDqRHGemu91F8AhkN2++++TI/-Tmp-/clang_crash-0n0c93.ii
clang-3: note: diagnostic msg: 
/var/folders/nG/nGiPDqRHGemu91F8AhkN2++++TI/-Tmp-/clang_crash-0n0c93.sh




More information about the cfe-dev mailing list