[llvm-bugs] [Bug 26507] New: Segmentation fault in clang::Decl::getTranslationUnitDecl with undeclared variable (clang 3.7.1)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 6 09:21:25 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26507

            Bug ID: 26507
           Summary: Segmentation fault in
                    clang::Decl::getTranslationUnitDecl with undeclared
                    variable (clang 3.7.1)
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oli.huber at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15844
  --> https://llvm.org/bugs/attachment.cgi?id=15844&action=edit
preprocessed c file

I've just move some code in a new file and forgot to copy a thread-local one. I
then got this segfault from clang:

[  6%] Building C object
numerics/CMakeFiles/numerics.dir/src/tools/NM_MUMPS.c.o
/home/xhub/siconos/numerics/src/tools/NM_MUMPS.c:29:7: error: use of undeclared
identifier 'NM_mpi_com'; did you mean 'NM_MPI_com'?
  if (NM_mpi_com == MPI_COMM_NULL)
      ^~~~~~~~~~
      NM_MPI_com                                                                
/home/xhub/siconos/numerics/src/tools/NM_MUMPS.c:27:10: note: 'NM_MPI_com'
declared here
MPI_Comm NM_MPI_com(MPI_Comm m)
         ^
/home/xhub/siconos/numerics/src/tools/NM_MUMPS.c:29:18: warning: comparison of
distinct pointer types ('MPI_Comm (*)(MPI_Comm)' and 'MPI_Comm' (aka 'struct
ompi_communicator_t *')) [-Wcompare-distinct-pointer-types]
  if (NM_mpi_com == MPI_COMM_NULL)
      ~~~~~~~~~~ ^  ~~~~~~~~~~~~~
#0 0x7faf16b54c97 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/bin/../lib64/libLLVMSupport.so.3.7+0xbfc97)
#1 0x7faf16b54209 (/usr/bin/../lib64/libLLVMSupport.so.3.7+0xbf209)
#2 0x7faf14ae45c0 (/lib64/libc.so.6+0x335c0)
#3 0x7faf125c33f0 clang::Decl::getTranslationUnitDecl()
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x1663f0)
#4 0x7faf125c3459 clang::Decl::getASTContext() const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x166459)
#5 0x7faf1267dd79 (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x220d79)
#6 0x7faf12684d3b clang::ASTContext::getASTRecordLayout(clang::RecordDecl
const*) const (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x227d3b)
#7 0x7faf1252e7ca clang::ASTContext::getTypeInfoImpl(clang::Type const*) const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xd17ca)
#8 0x7faf125262d4 clang::ASTContext::getTypeInfo(clang::Type const*) const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xc92d4)
#9 0x7faf1252e5c3 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xd15c3)
#10 0x7faf125262d4 clang::ASTContext::getTypeInfo(clang::Type const*) const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xc92d4)
#11 0x7faf1252ed55 clang::ASTContext::getTypeInfoInChars(clang::Type const*)
const (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xd1d55)
#12 0x7faf1252ee00 clang::ASTContext::getTypeInfoInChars(clang::QualType) const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xd1e00)
#13 0x7faf1252ee89 clang::ASTContext::getTypeSizeInChars(clang::QualType) const
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0xd1e89)
#14 0x7faf124e44cb _init
(/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x874cb)
#15 0x7faf1263a985 (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x1dd985)
#16 0x7faf1262b0e5 (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x1ce0e5)
#17 0x7faf12624ee5 (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x1c7ee5)
#18 0x7faf12626446 (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x1c9446)
#19 0x7faf1262767e clang::Expr::EvaluateForOverflow(clang::ASTContext const&)
const (/usr/bin/../lib64/../lib64/libclangAST.so.3.7+0x1ca67e)
#20 0x7faf10f8063e clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool, bool)
(/usr/bin/../lib64/../lib64/libclangSema.so.3.7+0x32e63e)
#21 0x7faf114d6eb4 clang::Parser::ParseIfStatement(clang::SourceLocation*)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xabeb4)
#22 0x7faf114d4b6b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xa9b6b)
#23 0x7faf114d50d6
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xaa0d6)
#24 0x7faf114d1d36 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xa6d36)
#25 0x7faf114da5d6 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xaf5d6)
#26 0x7faf114f26ae
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xc76ae)
#27 0x7faf11473eeb clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0x48eeb)
#28 0x7faf114ee191
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xc3191)
#29 0x7faf114ee75b
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xc375b)
#30 0x7faf114f4aad
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xc9aad)
#31 0x7faf114f53f2
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0xca3f2)
#32 0x7faf11455bf3 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/bin/../lib64/../lib64/libclangParse.so.3.7+0x2abf3)
#33 0x7faf15e13791 clang::CodeGenAction::ExecuteAction()
(/usr/bin/../lib64/libclangCodeGen.so.3.7+0x1f7791)
#34 0x7faf1569b1a6 clang::FrontendAction::Execute()
(/usr/bin/../lib64/libclangFrontend.so.3.7+0xa81a6)
#35 0x7faf1566c041
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/bin/../lib64/libclangFrontend.so.3.7+0x79041)
#36 0x7faf153f0a6f clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/bin/../lib64/libclangFrontendTool.so.3.7+0x2a6f)
#37 0x40fbd8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/bin/x86_64-pc-linux-gnu-clang-3.7+0x40fbd8)
#38 0x40b950 main (/usr/bin/x86_64-pc-linux-gnu-clang-3.7+0x40b950)
#39 0x7faf14ad16e0 __libc_start_main (/lib64/libc.so.6+0x206e0)
#40 0x40c359 _start (/usr/bin/x86_64-pc-linux-gnu-clang-3.7+0x40c359)
Stack dump:
0.      Program arguments: /usr/bin/x86_64-pc-linux-gnu-clang-3.7 -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-main-file-name NM_MUMPS.c -mrelocation-model pic -pic-level 2 -mthread-model
posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -g -dwarf-column-info
-coverage-file
/build/siconos-asan-clang/numerics/CMakeFiles/numerics.dir/src/tools/NM_MUMPS.c.o
-resource-dir /usr/bin/../lib/clang/3.7.1 -D numerics_EXPORTS -D
_LARGEFILE64_SOURCE -D _LARGEFILE_SOURCE -D _LARGEFILE64_SOURCE -D
_LARGEFILE_SOURCE -I /install/gams-current/apifiles/C/api -I
/install/gams-current/testlib_ml -I /build/siconos-asan-clang -I
/home/xhub/siconos/externals/. -I /home/xhub/siconos/externals/blas_lapack -I
/home/xhub/siconos/externals/hairer -I
/home/xhub/siconos/externals/netlib/dftemplates -I
/home/xhub/siconos/externals/netlib/odepack -I
/home/xhub/siconos/externals/numeric_bindings -I
/home/xhub/siconos/externals/ql0001 -I /home/xhub/siconos/externals/SOL/lumod-c
-I /home/xhub/siconos/externals/SuiteSparse/CSparse -I
/home/xhub/siconos/externals/tools -I /build/siconos-asan-clang/externals -I
/home/xhub/siconos/numerics/src/. -I /home/xhub/siconos/numerics/src/tools -I
/home/xhub/siconos/numerics/src/tools/InterfaceToPathFerris -I
/home/xhub/siconos/numerics/src/AVI -I /home/xhub/siconos/numerics/src/LCP -I
/home/xhub/siconos/numerics/src/MLCP -I /home/xhub/siconos/numerics/src/SOCP -I
/home/xhub/siconos/numerics/src/LinearSystem -I
/home/xhub/siconos/numerics/src/QP -I /home/xhub/siconos/numerics/src/Relay -I
/home/xhub/siconos/numerics/src/FrictionContact -I
/home/xhub/siconos/numerics/src/NCP -I /home/xhub/siconos/numerics/src/MCP -I
/home/xhub/siconos/numerics/src/GenericMechanical -I
/home/xhub/siconos/numerics/src/VI -I /build/siconos-asan-clang/numerics -I
/home/xhub/siconos/externals/blas_lapack/cblas_header -I /usr/include/lpsolve
-I /home/xhub/softs/lmgc90_dev/contribs/linearAlgebra/MUMPS_5.0.0/include -I
/install/usr/include -I /usr/lib64/python2.7/site-packages/numpy/core/include
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.7.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wno-string-plus-int -Wall
-Wuninitialized -Werror=unknown-warning-option -Wextra -Wno-unused-parameter
-Werror=implicit-function-declaration -Wno-sign-conversion
-Wno-error=sign-conversion -Werror=switch-bool -Werror=logical-not-parentheses
-Werror=sizeof-array-argument -Werror=array-bounds
-Werror=format-invalid-specifier -Werror=type-limits
-Werror=incompatible-pointer-types -Werror=missing-prototypes
-Werror=overloaded-virtual -std=c99 -fdebug-compilation-dir
/build/siconos-asan-clang/numerics -ferror-limit 19 -fmessage-length 271
-fsanitize=address,leak,alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr
-fsanitize-recover=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr
-fsanitize-blacklist=/usr/bin/../lib/clang/3.7.1/asan_blacklist.txt
-fno-assume-sane-operator-new -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o
CMakeFiles/numerics.dir/src/tools/NM_MUMPS.c.o -x c
/home/xhub/siconos/numerics/src/tools/NM_MUMPS.c 
1.      /home/xhub/siconos/numerics/src/tools/NM_MUMPS.c:30:3: current parser
token '{'
2.      /home/xhub/siconos/numerics/src/tools/NM_MUMPS.c:28:1: parsing function
body 'NM_MPI_com'
3.      /home/xhub/siconos/numerics/src/tools/NM_MUMPS.c:28:1: in compound
statement ('{}')
x86_64-pc-linux-gnu-clang-3.7: error: unable to execute command: Segmentation
fault
x86_64-pc-linux-gnu-clang-3.7: error: clang frontend command failed due to
signal (use -v to see invocation)
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: PLEASE submit a bug report
to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source,
and associated run script.
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: /tmp/NM_MUMPS-a51ca7.c
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: /tmp/NM_MUMPS-a51ca7.sh
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: 

********************
numerics/CMakeFiles/numerics.dir/build.make:302: recipe for target
'numerics/CMakeFiles/numerics.dir/src/tools/NM_MUMPS.c.o' failed

-- 
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/20160206/b9fe2c46/attachment-0001.html>


More information about the llvm-bugs mailing list