[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[creduce-bugs] Segfault in RemoveNamespace::handleOneUsingDirectiveDecl



Hi,

markus@x4 creduce_bug_002 % cat cra.ii
namespace streflop {
template <int> struct SoftFloatWrapper { operator long double() const; };
namespace SoftFloat {
typedef struct {
  long long low;
  int high;
} floatx80;
floatx80 float32_to_floatx80(int);
}
using namespace SoftFloat;
template <> SoftFloatWrapper<32>::operator long double() const {
  long double holder;
  *reinterpret_cast<floatx80 *>(&holder) = float32_to_floatx80(0);
  return holder;
}
}

markus@x4 creduce_bug_002 % gdb --args "/home/markus/creduce/creduce/../clang_delta/clang_delta" --transformation=remove-namespace --counter=1 cra.ii
Reading symbols from /home/markus/creduce/creduce/../clang_delta/clang_delta...done.
(gdb) r
Starting program: /home/markus/creduce/clang_delta/clang_delta --transformation=remove-namespace --counter=1 cra.ii
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
clang::IdentifierInfo::getName (this=0x0) at /usr/local/include/clang/Basic/IdentifierTable.h:127
127         return StringRef(getNameStart(), getLength());
(gdb) bt
#0  clang::IdentifierInfo::getName (this=0x0) at /usr/local/include/clang/Basic/IdentifierTable.h:127
#1  0x000000000098a370 in RemoveNamespace::handleOneUsingDirectiveDecl (this=this@entry=0x2f40940, UD=0x2fd4890, ParentCtx=ParentCtx@entry=0x2f7f180)
    at RemoveNamespace.cpp:879
#2  0x000000000098ae57 in RemoveNamespace::handleOneNamedDecl (this=this@entry=0x2f40940, ND=<optimized out>, ParentCtx=ParentCtx@entry=0x2f7f180, NamespaceName="streflop")
    at RemoveNamespace.cpp:919
#3  0x000000000098b60d in RemoveNamespace::addNamedDeclsFromNamespace (this=this@entry=0x2f40940, ND=ND@entry=0x2f7fe28) at RemoveNamespace.cpp:974
#4  0x000000000098b788 in RemoveNamespace::handleOneNamespaceDecl (this=0x2f40940, ND=ND@entry=0x2f7fe28) at RemoveNamespace.cpp:995
#5  0x000000000098b79a in RemoveNamespaceASTVisitor::VisitNamespaceDecl (this=this@entry=0x2f800e0, ND=ND@entry=0x2f7fe28) at RemoveNamespace.cpp:122
#6  0x00000000009a7c11 in clang::RecursiveASTVisitor<RemoveNamespaceASTVisitor>::WalkUpFromNamespaceDecl (D=0x2f7fe28, this=<optimized out>)
    at /usr/local/include/clang/AST/DeclNodes.inc:99
#7  clang::RecursiveASTVisitor<RemoveNamespaceASTVisitor>::TraverseNamespaceDecl (this=0x2f800e0, D=0x2f7fe28) at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1350
#8  0x00000000009a7235 in clang::RecursiveASTVisitor<RemoveNamespaceASTVisitor>::TraverseDecl (this=this@entry=0x2f800e0, D=D@entry=0x2f7fe28)
    at /usr/local/include/clang/AST/DeclNodes.inc:99
#9  0x00000000009a78be in clang::RecursiveASTVisitor<RemoveNamespaceASTVisitor>::TraverseDeclContextHelper (this=0x2f800e0, DC=<optimized out>)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1236
#10 0x00000000009a7fc0 in clang::RecursiveASTVisitor<RemoveNamespaceASTVisitor>::TraverseTranslationUnitDecl (this=<optimized out>, D=<optimized out>)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1326
#11 0x00000000009a76c7 in clang::RecursiveASTVisitor<RemoveNamespaceASTVisitor>::TraverseDecl (this=0x2f800e0, D=0x2f7f160) at /usr/local/include/clang/AST/DeclNodes.inc:491
#12 0x00000000009a77d4 in RemoveNamespace::HandleTranslationUnit (this=0x2f40940, Ctx=...) at RemoveNamespace.cpp:671
#13 0x0000000001412972 in clang::ParseAST(clang::Sema&, bool, bool) ()
#14 0x00000000011a56a1 in TransformationManager::doTransformation (this=0x2f4be90, ErrorMsg="", ErrorCode=@0x2e82ab0: -1) at TransformationManager.cpp:245
#15 0x00000000004f574c in main (argc=4, argv=0x7fffffffe4b8) at ClangDelta.cpp:211


BTW creduce now fails to compile on LLVM trunk, because of a new
static assertion in SmallPtrSet.h:

In file included from RemoveUnusedFunction.h:17:0,
                 from RemoveUnusedFunction.cpp:15:
/usr/local/include/llvm/ADT/SmallPtrSet.h: In instantiation of ‘class llvm::SmallPtrSet<const clang::FunctionDecl*, 50u>’:
RemoveUnusedFunction.h:173:20:   required from here
/usr/local/include/llvm/ADT/SmallPtrSet.h:335:3: error: static assertion failed: SmallSize should be small
   static_assert(SmallSize <= 32, "SmallSize should be small");
   ^~~~~~~~~~~~~
/usr/local/include/llvm/ADT/SmallPtrSet.h: In instantiation of ‘class llvm::SmallPtrSet<const clang::UsingDecl*, 50u>’:
RemoveUnusedFunction.h:179:17:   required from here
/usr/local/include/llvm/ADT/SmallPtrSet.h:335:3: error: static assertion failed: SmallSize should be small

I've just commented out the assert for now.

Thanks.

-- 
Markus