[llvm-bugs] [Bug 46774] New: Crash on ternary op with _ExtInt and a different type

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 18 12:47:44 PDT 2020


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

            Bug ID: 46774
           Summary: Crash on ternary op with _ExtInt and a different type
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ch3root at openwall.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 23753
  --> https://bugs.llvm.org/attachment.cgi?id=23753&action=edit
preprocessed source

clang segfaults on a ternary operator with mismatching types _ExtInt and int:

----------------------------------------------------------------------
int main()
{
    _ExtInt(2) x = 0;
    0 ? x : 0;
}
----------------------------------------------------------------------
$ clang test.c
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/user/cc/clang/bin/clang-11 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name test.c
-mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/home/user/cc/clang/lib/clang/12.0.0 -internal-isystem /usr/local/include
-internal-isystem /home/user/cc/clang/lib/clang/12.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/user/c -ferror-limit 19 -fgnuc-version=4.2.1
-fcolor-diagnostics -faddrsig -o /tmp/test-e4a687.o -x c test.c 
1.      test.c:4:14: current parser token ';'
2.      test.c:2:1: parsing function body 'main'
3.      test.c:2:1: in compound statement ('{}')
 #0 0x00005644482743ba llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/user/cc/clang/bin/clang-11+0x1b693ba)
 #1 0x0000564448272284 llvm::sys::RunSignalHandlers()
(/home/user/cc/clang/bin/clang-11+0x1b67284)
 #2 0x00005644482723b8 SignalHandler(int)
(/home/user/cc/clang/bin/clang-11+0x1b673b8)
 #3 0x00007f298f0eb730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #4 0x0000564449e34287
clang::Sema::PrepareScalarCast(clang::ActionResult<clang::Expr*, true>&,
clang::QualType) (/home/user/cc/clang/bin/clang-11+0x3729287)
 #5 0x0000564449e6fb60
clang::Sema::CheckConditionalOperands(clang::ActionResult<clang::Expr*, true>&,
clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*,
true>&, clang::ExprValueKind&, clang::ExprObjectKind&, clang::SourceLocation)
(/home/user/cc/clang/bin/clang-11+0x3764b60)
 #6 0x0000564449e700e8 clang::Sema::ActOnConditionalOp(clang::SourceLocation,
clang::SourceLocation, clang::Expr*, clang::Expr*, clang::Expr*)
(/home/user/cc/clang/bin/clang-11+0x37650e8)
 #7 0x0000564449b546c7
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) (.localalias.318)
(/home/user/cc/clang/bin/clang-11+0x34496c7)
 #8 0x0000564449b560e9
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/home/user/cc/clang/bin/clang-11+0x344b0e9)
 #9 0x0000564449ba229a
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/home/user/cc/clang/bin/clang-11+0x349729a)
#10 0x0000564449ba309b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/home/user/cc/clang/bin/clang-11+0x349809b)
#11 0x0000564449ba3e69
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/home/user/cc/clang/bin/clang-11+0x3498e69)
#12 0x0000564449ba7c21 clang::Parser::ParseCompoundStatementBody(bool)
(/home/user/cc/clang/bin/clang-11+0x349cc21)
#13 0x0000564449baab93 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/home/user/cc/clang/bin/clang-11+0x349fb93)
#14 0x0000564449b0fc02
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/home/user/cc/clang/bin/clang-11+0x3404c02)
#15 0x0000564449b37f36 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/user/cc/clang/bin/clang-11+0x342cf36)
#16 0x0000564449b0b091
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/user/cc/clang/bin/clang-11+0x3400091)
#17 0x0000564449b0b6c1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.266)
(/home/user/cc/clang/bin/clang-11+0x34006c1)
#18 0x0000564449b11a10
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias.278)
(/home/user/cc/clang/bin/clang-11+0x3406a10)
#19 0x0000564449b128eb
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/user/cc/clang/bin/clang-11+0x34078eb)
#20 0x0000564449b12f17
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/user/cc/clang/bin/clang-11+0x3407f17)
#21 0x0000564449b06c27 clang::ParseAST(clang::Sema&, bool, bool)
(/home/user/cc/clang/bin/clang-11+0x33fbc27)
#22 0x0000564448a19821 clang::FrontendAction::Execute()
(/home/user/cc/clang/bin/clang-11+0x230e821)
#23 0x00005644489d7c63
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/user/cc/clang/bin/clang-11+0x22ccc63)
#24 0x0000564448adcf8b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/user/cc/clang/bin/clang-11+0x23d1f8b)
#25 0x00005644471c7408 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/user/cc/clang/bin/clang-11+0xabc408)
#26 0x00005644471c4feb ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/user/cc/clang/bin/clang-11+0xab9feb)
#27 0x000056444714e8c4 main (/home/user/cc/clang/bin/clang-11+0xa438c4)
#28 0x00007f298e9ec09b __libc_start_main
/build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:342:3
#29 0x00005644471c4afa _start (/home/user/cc/clang/bin/clang-11+0xab9afa)
clang-11: error: unable to execute command: Segmentation fault
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project
cbff0c75b9ea120bc6ec1ecc2e8d431fd6143236)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/user/cc/clang/bin
clang-11: note: diagnostic msg: 
********************

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

********************
----------------------------------------------------------------------
clang x86-64 version: clang version 12.0.0
(https://github.com/llvm/llvm-project cbff0c75b9ea120bc6ec1ecc2e8d431fd6143236)
----------------------------------------------------------------------

-- 
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/20200718/7803d461/attachment.html>


More information about the llvm-bugs mailing list