<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Segmentation fault in clang::Decl::getTranslationUnitDecl with undeclared variable (clang 3.7.1)"
   href="https://llvm.org/bugs/show_bug.cgi?id=26507">26507</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault in clang::Decl::getTranslationUnitDecl with undeclared variable (clang 3.7.1)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>oli.huber@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15844" name="attach_15844" title="preprocessed c file">attachment 15844</a> <a href="attachment.cgi?id=15844&action=edit" title="preprocessed c file">[details]</a></span>
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 <a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>