[LLVMbugs] [Bug 9269] New: clang/lib/Analysis/CFG.cpp:1558: clang::CFGBlock*<unnamed>::CFGBuilder::VisitForStmt(clang::ForStmt*): Assertion `Block == EntryConditionBlock || (Block == 0 && EntryConditionBlock == Succ)' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 19 13:55:12 PST 2011


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

           Summary: clang/lib/Analysis/CFG.cpp:1558:
                    clang::CFGBlock*<unnamed>::CFGBuilder::VisitForStmt(cl
                    ang::ForStmt*): Assertion `Block ==
                    EntryConditionBlock || (Block == 0 &&
                    EntryConditionBlock == Succ)' 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
            Blocks: 4068


Compiling speedstep-centrino.c from the Linux kernel triggers assert in clang:
clang:
/home/edwin/HDD/edwin/llvm-git/offi/llvm/tools/clang/lib/Analysis/CFG.cpp:1558:
clang::CFGBlock*<unnamed>::CFGBuilder::VisitForStmt(clang::ForStmt*): Assertion
`Block == EntryConditionBlock || (Block == 0 && EntryConditionBlock == Succ)'
failed.
0  clang           0x0000000001505b1f
1  clang           0x0000000001507d82
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           0x0000000000c04c32
7  clang           0x0000000000bfef64
8  clang           0x0000000000bff9d8
9  clang           0x0000000000c027ce clang::CFG::buildCFG(clang::Decl const*,
clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions) + 1646
10 clang           0x0000000000bf26e5 clang::AnalysisContext::getCFG() + 181
11 clang           0x0000000000aebd8e
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::Decl const*, clang::QualType) + 638
12 clang           0x000000000092468d
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 701
13 clang           0x000000000087c9a8
clang::Parser::ParseFunctionStatementBody(clang::Decl*) + 168
14 clang           0x0000000000886f83
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 707
15 clang           0x000000000088de8f
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*) + 1535
16 clang           0x0000000000885b82
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 146
17 clang           0x0000000000885f89
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 409
18 clang           0x0000000000888132
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1506
19 clang           0x000000000088826d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 109
20 clang           0x000000000086ebab clang::ParseAST(clang::Sema&, bool) + 139
21 clang           0x000000000074c0b4 clang::CodeGenAction::ExecuteAction() +
68
22 clang           0x0000000000630a6b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 347
23 clang           0x000000000060b8ac
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1276
24 clang           0x000000000060327f cc1_main(char const**, char const**, char
const*, void*) + 415
25 clang           0x000000000060a8b5 main + 4629
26 libc.so.6       0x0000003f35e1ec4d __libc_start_main + 253
27 clang           0x0000000000601959
Stack dump:
0.      Program arguments:
/home/edwin/HDD/edwin/llvm-git/offi/obj/Release+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name speedstep-centrino.c
-mrelocation-model static -mdisable-fp-elim -relaxed-aliasing -masm-verbose
-mconstructor-aliases -mcode-model kernel -disable-red-zone -target-cpu x86-64
-target-feature -sse -target-feature -mmx -target-feature -sse2 -target-feature
-3dnow -target-linker-version 2.20.1 -momit-leaf-frame-pointer -g -nostdinc
-resource-dir
/home/edwin/HDD/edwin/llvm-git/offi/obj/Release+Asserts/bin/../lib/clang/2.9
-dependency-file arch/x86/kernel/cpu/cpufreq/.speedstep-centrino.o.d -MT
arch/x86/kernel/cpu/cpufreq/.tmp_speedstep-centrino.o -sys-header-deps -isystem
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include -include
include/generated/autoconf.h -D __KERNEL__ -D CONFIG_AS_CFI=1 -D
CONFIG_AS_CFI_SIGNAL_FRAME=1 -D CONFIG_AS_CFI_SECTIONS=1 -D CONFIG_AS_FXSAVEQ=1
-D KBUILD_STR(s)=#s -D KBUILD_BASENAME=KBUILD_STR(speedstep_centrino) -D
KBUILD_MODNAME=KBUILD_STR(speedstep_centrino) -I
/home/edwin/builds/linux-2.6/arch/x86/include -I include -Os -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -Werror-implicit-function-declaration
-Wno-format-security -Wno-sign-compare -Wframe-larger-than=2048
-Wdeclaration-after-statement -Wno-pointer-sign -Wno-unused-value
-Wno-array-bounds -Wno-unused-variable -ferror-limit 19 -fmessage-length 147
-pg -stack-protector 1 -fgnu-runtime -fno-common -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/cc-s6bvtc.s -x c
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c 
1.      arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c:323:1: current parser
token 'static'
2.      arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c:288:1: parsing
function body 'extract_clock'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)


Here is reduced testcase, hope I got it right this time:
extern unsigned long __per_cpu_offset[4096];
        struct cpufreq_frequency_table {
       unsigned int frequency;
       };
           struct cpu_model {
        struct cpufreq_frequency_table *op_points;
      };
         __attribute__((section(".data..percpu" ""))) __attribute__((weak))
__typeof__(struct cpu_model *) centrino_model;
           static unsigned extract_clock(unsigned msr, unsigned int cpu, int
failsafe) {
       int i;
             if (((*({
    ({
  unsigned long __ptr;
  (typeof((typeof(*(&(centrino_model))) *)(&(centrino_model)))) (__ptr +
(((__per_cpu_offset[cpu]))));
  }
   );
    }
     ))->op_points))   return 0;
       for (i = 0;
        (*({
    while (0);
    ({
  unsigned long __ptr;
  (typeof((typeof(*(&(centrino_model))) *)(&(centrino_model)))) (__ptr +
(((__per_cpu_offset[cpu]))));
  }
   );
    }
     ))->op_points[i].frequency        != ~1;
            i++) {
   }
    }


clang:
/home/edwin/HDD/edwin/llvm-git/offi/llvm/tools/clang/lib/Analysis/CFG.cpp:1558:
clang::CFGBlock*<unnamed>::CFGBuilder::VisitForStmt(clang::ForStmt*): Assertion
`Block == EntryConditionBlock || (Block == 0 && EntryConditionBlock == Succ)'
failed.
0  clang           0x0000000001505b1f
1  clang           0x0000000001507d82
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           0x0000000000c04c32
7  clang           0x0000000000bfef64
8  clang           0x0000000000bff9d8
9  clang           0x0000000000c027ce clang::CFG::buildCFG(clang::Decl const*,
clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions) + 1646
10 clang           0x0000000000bf26e5 clang::AnalysisContext::getCFG() + 181
11 clang           0x0000000000aebd8e
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::Decl const*, clang::QualType) + 638
12 clang           0x000000000092468d
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 701
13 clang           0x000000000087c9a8
clang::Parser::ParseFunctionStatementBody(clang::Decl*) + 168
14 clang           0x0000000000886f83
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 707
15 clang           0x000000000088de8f
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*) + 1535
16 clang           0x0000000000885b82
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 146
17 clang           0x0000000000885f89
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 409
18 clang           0x0000000000888132
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1506
19 clang           0x000000000088826d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 109
20 clang           0x000000000086ebab clang::ParseAST(clang::Sema&, bool) + 139
21 clang           0x000000000074c0b4 clang::CodeGenAction::ExecuteAction() +
68
22 clang           0x0000000000630a6b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 347
23 clang           0x000000000060b8ac
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1276
24 clang           0x000000000060327f cc1_main(char const**, char const**, char
const*, void*) + 415
25 clang           0x000000000060a8b5 main + 4629
26 libc.so.6       0x0000003f35e1ec4d __libc_start_main + 253
27 clang           0x0000000000601959
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
x.i -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 x.o -x cpp-output x.i 
1.      <eof> parser at end of file
2.      x.i:9:88: parsing function body 'extract_clock'
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