[LLVMbugs] [Bug 11069] New: infinite loop in clang::runUninitializedVariablesAnalysis (?)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 5 13:51:38 PDT 2011


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

           Summary: infinite loop in
                    clang::runUninitializedVariablesAnalysis (?)
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pageexec at freemail.hu
                CC: llvmbugs at cs.uiuc.edu


while compiling linux-3.0.4/kernel/mutex.c clang (r141199 but it's been
happening for many weeks now) seemingly enters an infinite loop with the
following backtrace when interrupted in gdb:

(gdb) bt
#0  0x0000000000c9d5a7 in (anonymous namespace)::CFGBlockValues::getValueVector
(this=0x3a36bde8290, block=0x24514a0, dstBlock=0x0) at
/mnt/root32/root/src/devel/llvm/llvm.svn/tools/clang/lib/Analysis/UninitializedValues.cpp:192
#1  0x0000000000c9e03f in updateValueVectorWithScratch (this=0x3a36bde8290,
block=0x24514a0) at
/mnt/root32/root/src/devel/llvm/llvm.svn/tools/clang/lib/Analysis/UninitializedValues.cpp:235
#2  runOnBlock (block=<optimized out>, cfg=..., ac=..., vals=<optimized out>,
wasAnalyzed=<optimized out>, handler=0x0) at
llvm.svn/tools/clang/lib/Analysis/UninitializedValues.cpp:656
#3  0x0000000000c9f136 in clang::runUninitializedVariablesAnalysis (dc=...,
cfg=..., ac=..., handler=..., stats=...) at
llvm.svn/tools/clang/lib/Analysis/UninitializedValues.cpp:694
#4  0x0000000000b1c73c in clang::sema::AnalysisBasedWarnings::IssueWarnings
(this=0x163d870, P=<optimized out>, fscope=<optimized out>, D=<optimized out>,
blkExpr=0x244e820) at
llvm.svn/tools/clang/lib/Sema/AnalysisBasedWarnings.cpp:881
#5  0x00000000008a989c in clang::Sema::PopFunctionOrBlockScope (this=0x163cb50,
WP=<optimized out>, D=<optimized out>, blkExpr=<optimized out>) at
llvm.svn/tools/clang/lib/Sema/Sema.cpp:804
#6  0x000000000091f713 in clang::Sema::ActOnFinishFunctionBody (this=0x163cb50,
dcl=0x2437970, Body=0x243c5a0, IsInstantiation=false) at
llvm.svn/tools/clang/lib/Sema/SemaDecl.cpp:6980
#7  0x000000000083d755 in clang::Parser::ParseFunctionStatementBody
(this=0x163e1e0, Decl=0x2437970, BodyScope=...) at
llvm.svn/tools/clang/lib/Parse/ParseStmt.cpp:1925
#8  0x0000000000856bd0 in clang::Parser::ParseFunctionDefinition
(this=0x163e1e0, D=..., TemplateInfo=...) at
llvm.svn/tools/clang/lib/Parse/Parser.cpp:994
#9  0x0000000000865b9b in clang::Parser::ParseDeclGroup (this=0x163e1e0,
DS=..., Context=0, AllowFunctionDefinitions=true, DeclEnd=0x0, FRI=0x0) at
llvm.svn/tools/clang/lib/Parse/ParseDecl.cpp:1023
#10 0x00000000008521c5 in clang::Parser::ParseDeclarationOrFunctionDefinition
(this=0x163e1e0, DS=..., AS=clang::AS_none) at
llvm.svn/tools/clang/lib/Parse/Parser.cpp:812
#11 0x00000000008526de in clang::Parser::ParseDeclarationOrFunctionDefinition
(this=0x163e1e0, attrs=<optimized out>, AS=clang::AS_none) at
llvm.svn/tools/clang/lib/Parse/Parser.cpp:825
#12 0x00000000008546bf in clang::Parser::ParseExternalDeclaration
(this=0x163e1e0, attrs=..., DS=0x0) at
llvm.svn/tools/clang/lib/Parse/Parser.cpp:695
#13 0x0000000000854abf in clang::Parser::ParseTopLevelDecl (this=0x163e1e0,
Result=...) at llvm.svn/tools/clang/lib/Parse/Parser.cpp:511
#14 0x000000000082d49d in clang::ParseAST (S=..., PrintStats=false) at
llvm.svn/tools/clang/lib/Parse/ParseAST.cpp:84
#15 0x00000000006fe354 in clang::CodeGenAction::ExecuteAction (this=0x1619d60)
at llvm.svn/tools/clang/lib/CodeGen/CodeGenAction.cpp:346
#16 0x00000000005ee4d5 in clang::CompilerInstance::ExecuteAction
(this=0x1615c20, Act=...) at
llvm.svn/tools/clang/lib/Frontend/CompilerInstance.cpp:631
#17 0x00000000005d573e in clang::ExecuteCompilerInvocation (Clang=0x1615c20) at
llvm.svn/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:172
#18 0x00000000005cc1e1 in cc1_main (ArgBegin=0x3a36bdead10,
ArgEnd=0x3a36bdeb068, Argv0=0x1613438 "build.amd64/image/bin/clang",
MainAddr=0x5d29d0) at llvm.svn/tools/clang/tools/driver/cc1_main.cpp:159
#19 0x00000000005ca784 in main (argc_=109, argv_=0x3a36bdebe68) at
llvm.svn/tools/clang/tools/driver/driver.cpp:354

i tried to isolate a minimal example but it didn't work out, so i guess some
non-trivial context is also needed. the linux code in question is in

    kernel/mutex.c: static inline int __sched __mutex_lock_common(struct mutex
*lock, long state, unsigned int subclass, struct lockdep_map *nest_lock,
unsigned long ip)

and CONFIG_MUTEX_SPIN_ON_OWNER must be enabled in .config to enable the
following code (comments removed):

143 #ifdef CONFIG_MUTEX_SPIN_ON_OWNER
162 »·······for (;;) {
163 »·······»·······struct task_struct *owner;
164
169 »·······»·······owner = ACCESS_ONCE(lock->owner);
170 »·······»·······if (owner && !mutex_spin_on_owner(lock, owner))
171 »·······»·······»·······break;
172
173 »·······»·······if (atomic_cmpxchg(&lock->count, 1, 0) == 1) {
174 »·······»·······»·······lock_acquired(&lock->dep_map, ip);
175 »·······»·······»·······mutex_set_owner(lock);
176 »·······»·······»·······preempt_enable();
177 »·······»·······»·······return 0;
178 »·······»·······}
179
186 »·······»·······if (!owner && (need_resched() || rt_task(task)))
187 »·······»·······»·······break;
188
195 »·······»·······arch_mutex_cpu_relax();
196 »·······}
197 #endif

if i remove this infinite loop, the file compiles fine.

-- 
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