[LLVMbugs] [Bug 9262] New: clang/lib/AST/ExprConstant.cpp:2654: llvm::APSInt clang::Expr::EvaluateAsInt(const clang::ASTContext&) const: Assertion `Result && "Could not evaluate expression"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 19 03:45:44 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9262

           Summary: clang/lib/AST/ExprConstant.cpp:2654: llvm::APSInt
                    clang::Expr::EvaluateAsInt(const clang::ASTContext&)
                    const: Assertion `Result && "Could not evaluate
                    expression"' failed.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


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::ASTMultiPtr<clang::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::OpaquePtr<clang::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)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list