Skip to content

[Linux Kernel] ExprConstant.cpp:2654: llvm::APSInt clang::Expr::EvaluateAsInt(const clang::ASTContext&) const: Assertion `Result && "Could not evaluate expression"' failed. #9634

Closed
@edwintorok

Description

@edwintorok
Bugzilla Link 9262
Resolution FIXED
Resolved on Feb 26, 2011 02:27
Version trunk
OS Linux
CC @rjmccall

Extended Description

arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c triggers an assert in Clang's preprocessor it seems.

Testcase:
struct mem_section {
};
extern struct mem_section *mem_section[((((1UL << (46 - 27))) + ((((1UL) << 12) / sizeof (struct mem_section))) - 1) / ((((1UL) << 12) / sizeof (struct mem_section))))];

clang: /home/edwin/HDD/edwin/llvm-git/offi/llvm/tools/clang/lib/AST/ExprConstant.cpp:2654: llvm::APSInt clang::Expr::EvaluateAsInt(const clang::ASTContext&) const: Assertion `Result && "Could not evaluate expression"' failed.
0 clang 0x00000000015056ef
1 clang 0x0000000001507952
2 libpthread.so.0 0x0000003f36a0ef60
3 libc.so.6 0x0000003f35e32165 gsignal + 53
4 libc.so.6 0x0000003f35e34f70 abort + 384
5 libc.so.6 0x0000003f35e2b2b1 __assert_fail + 241
6 clang 0x0000000000ce9d82
7 clang 0x0000000000cea6a4
8 clang 0x0000000000cea224
9 clang 0x0000000000cea9ac clang::Expr::isIntegerConstantExpr(llvm::APSInt&, clang::ASTContext&, clang::SourceLocation*, bool) const + 44
10 clang 0x0000000000ae17f1 clang::Sema::BuildArrayType(clang::QualType, clang::ArrayType::ArraySizeModifier, clang::Expr*, unsigned int, clang::SourceRange, clang::DeclarationName) + 2401
11 clang 0x0000000000ae5e57 clang::Sema::GetTypeForDeclarator(clang::Declarator&, clang::Scope*, clang::TagDecl**) + 2327
12 clang 0x000000000093c59e clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, clang::ASTMultiPtrclang::TemplateParameterList*, bool) + 302
13 clang 0x000000000088bb72 clang::Parser::ParseDeclarationAfterDeclarator(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&) + 114
14 clang 0x000000000088dae0 clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation*) + 768
15 clang 0x0000000000885ad2 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&, clang::AccessSpecifier) + 146
16 clang 0x0000000000885ed9 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::AccessSpecifier) + 409
17 clang 0x0000000000888082 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::Parser::ParsingDeclSpec*) + 1506
18 clang 0x00000000008881bd clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) + 109
19 clang 0x000000000086eafb clang::ParseAST(clang::Sema&, bool) + 139
20 clang 0x000000000074c004 clang::CodeGenAction::ExecuteAction() + 68
21 clang 0x00000000006309bb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 347
22 clang 0x000000000060b7fc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1276
23 clang 0x00000000006031cf cc1_main(char const**, char const**, char const*, void*) + 415
24 clang 0x000000000060a805 main + 4629
25 libc.so.6 0x0000003f35e1ec4d __libc_start_main + 253
26 clang 0x00000000006018a9
Stack dump:
0. Program arguments: /home/edwin/HDD/edwin/llvm-git/offi/obj/Release+Asserts/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name 14589.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.20.1 -momit-leaf-frame-pointer -resource-dir /home/edwin/HDD/edwin/llvm-git/offi/obj/Release+Asserts/bin/../lib/clang/2.9 -ferror-limit 19 -fmessage-length 147 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-WvE2y5.o -x c tmp8/14589.c

  1.  tmp8/14589.c:3:169: current parser token ';'
    

clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see invocation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions