[llvm-bugs] [Bug 31587] New: SIGSEGV parsing code that uses the Microsoft __FUNCSIG__ predefined macro

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 9 12:14:14 PST 2017


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

            Bug ID: 31587
           Summary: SIGSEGV parsing code that uses the Microsoft
                    __FUNCSIG__ predefined macro
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thonerma at synopsys.com
                CC: llvm-bugs at lists.llvm.org,
                    sig-rnd-sat-clang-bugs at synopsys.com
    Classification: Unclassified

Clang 3.5 through trunk (r278953) SIGSEGV on the following test code:

$ cat t.c
void f() {
    __FUNCSIG__;
}

$ clang --version
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

$ clang -c -fms-extensions t.c
#0 0x00000000025ae342 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/lib/Support/Unix/Signals.inc:402:11
#1 0x00000000025ae889 PrintStackTraceSignalHandler(void*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/lib/Support/Unix/Signals.inc:470:1
#2 0x00000000025ab3fd llvm::sys::RunSignalHandlers()
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/lib/Support/Signals.cpp:45:5
#3 0x00000000025aec3c SignalHandler(int)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/lib/Support/Unix/Signals.inc:256:1
#4 0x000000000278cf00 __restore_rt
(/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/clang-3.9+0x278cf00)
#5 0x00000000028e7004 clang::FunctionType::getExtInfo() const
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/include/clang/AST/Type.h:3018:64
#6 0x00000000028deda5 clang::FunctionType::getCallConv() const
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/include/clang/AST/Type.h:3017:44
#7 0x00000000059a2a61
clang::PredefinedExpr::ComputeName(clang::PredefinedExpr::IdentType,
clang::Decl const*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/AST/Expr.cpp:541:7
#8 0x0000000004ac902e clang::Sema::BuildPredefinedExpr(clang::SourceLocation,
clang::PredefinedExpr::IdentType)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Sema/SemaExpr.cpp:3081:16
#9 0x0000000004ac9bfc clang::Sema::ActOnPredefinedExpr(clang::SourceLocation,
clang::tok::TokenKind)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Sema/SemaExpr.cpp:3119:10
#10 0x0000000004429e39 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseExpr.cpp:1000:11
#11 0x0000000004424df3 clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseExpr.cpp:479:20
#12 0x0000000004423450
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseExpr.cpp:169:20
#13 0x000000000442332f
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseExpr.cpp:121:18
#14 0x00000000044866e9 clang::Parser::ParseExprStatement()
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseStmt.cpp:402:19
#15 0x000000000448588b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseStmt.cpp:225:12
#16 0x0000000004484bd0
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseStmt.cpp:113:20
#17 0x000000000448c327 clang::Parser::ParseCompoundStatementBody(bool)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseStmt.cpp:987:11
#18 0x000000000448ce7f clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseStmt.cpp:1951:21
#19 0x00000000043bc7b8
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/Parser.cpp:1173:3
#20 0x00000000043e109b clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseDecl.cpp:1791:11
#21 0x00000000043bb82f
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/Parser.cpp:940:10
#22 0x00000000043bafa0
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/Parser.cpp:956:12
#23 0x00000000043ba84d
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/Parser.cpp:808:12
#24 0x00000000043b98e1
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/Parser.cpp:595:12
#25 0x00000000043b2d29 clang::ParseAST(clang::Sema&, bool, bool)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Parse/ParseAST.cpp:150:7
#26 0x0000000003017f55 clang::ASTFrontendAction::ExecuteAction()
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Frontend/FrontendAction.cpp:558:1
#27 0x00000000035bd6a4 clang::CodeGenAction::ExecuteAction()
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/CodeGen/CodeGenAction.cpp:854:1
#28 0x0000000003017580 clang::FrontendAction::Execute()
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Frontend/FrontendAction.cpp:461:7
#29 0x0000000002f8278a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/Frontend/CompilerInstance.cpp:868:7
#30 0x00000000031aca38
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:241:8
#31 0x000000000049e767 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/tools/driver/cc1_main.cpp:116:11
#32 0x000000000048eb00 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/tools/driver/driver.cpp:301:5
#33 0x000000000048c8e4 main
/slowfs/sighome/thonerma/sig-sat-home/src/llvm-3.9.0.src/tools/clang/tools/driver/driver.cpp:382:5
#34 0x0000000005e439a4 __libc_start_main
(/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/clang-3.9+0x5e439a4)
#35 0x000000000048b851 _start
(/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/clang-3.9+0x48b851)
Stack dump:
0.      Program arguments:
/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/clang-3.9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name t.c -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-coverage-file /slowfs/sighome/thonerma/tmp/t.c -resource-dir
/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/../lib/clang/3.9.0
-internal-isystem /usr/local/include -internal-isystem
/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /slowfs/sighome/thonerma/tmp -ferror-limit 19
-fmessage-length 237 -fms-extensions -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o t.o -x c t.c
1.      t.c:2:5: current parser token '__FUNCSIG__'
2.      t.c:1:10: parsing function body 'f'
3.      t.c:1:10: in compound statement ('{}')
clang-3.9: error: unable to execute command: Segmentation fault (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/slowfs/sighome/thonerma/sig-sat-home/products/linux-x86/clang-3.9.0/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/t-0442a5.c
clang-3.9: note: diagnostic msg: /tmp/t-0442a5.sh
clang-3.9: note: diagnostic msg:

********************


$ cat /tmp/t-0442a5.c
# 1 "<built-in>"
# 1 "t.c"
void f() {
    __FUNCSIG__;
}


$ cat /tmp/t-0442a5.sh
# Crash reproducer for clang version 3.9.0 (tags/RELEASE_390/final)
# Driver args: "-c" "-fms-extensions" "t.c"
# Original command: 
"/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/clang-3.9"
"-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all"
"-disable-free" "-main-file-name" "t.c" "-mrelocation-model" "static"
"-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
"-dwarf-column-info" "-debugger-tuning=gdb" "-coverage-file"
"/slowfs/sighome/thonerma/tmp/t.c" "-resource-dir"
"/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/../lib/clang/3.9.0"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/../lib/clang/3.9.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdebug-compilation-dir" "/slowfs/sighome/thonerma/tmp"
"-ferror-limit" "19" "-fmessage-length" "237" "-fms-extensions"
"-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o"
"t.o" "-x" "c" "t.c"
 "/slowfs/sig-sat/home/thonerma/products/linux-x86/clang-3.9.0/bin/clang-3.9"
"-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all"
"-disable-free" "-main-file-name" "t.c" "-mrelocation-model" "static"
"-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
"-dwarf-column-info" "-debugger-tuning=gdb" "-ferror-limit" "19"
"-fmessage-length" "237" "-fms-extensions" "-fobjc-runtime=gcc"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "c" "t-0442a5.c"

-- 
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/20170109/ab7e137d/attachment-0001.html>


More information about the llvm-bugs mailing list