[LLVMbugs] [Bug 9614] New: clang generates endless loop
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Apr 2 18:15:12 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9614
Summary: clang generates endless loop
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: kolesen.a at gmail.com
CC: llvmbugs at cs.uiuc.edu
Clang generates llvm intermediate code with an endless loop, when -O is used.
Here is source .c code:
$ cat test.c
#include <wchar.h>
int main ()
{
return btowc ('\0');
}
And after compilation we have:
(gdb) disas main
Dump of assembler code for function main:
0x00000000004004f0 <+0>: jmp 0x4004f0 <main>
End of assembler dump.
Here is LLVM IR:
$ clang -S -emit-llvm test.c; cat test.s
; ModuleID = 'test.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-pc-linux-gnu"
define i32 @main() nounwind {
%1 = alloca i32, align 4
store i32 0, i32* %1
%2 = call i32 @btowc(i32 0) nounwind
ret i32 %2
}
declare i32 @btowc(i32) nounwind
$ clang -O -S -emit-llvm test.c; cat test.s
; ModuleID = 'test.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-pc-linux-gnu"
define i32 @main() nounwind readnone {
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %0
br label %tailrecurse.i
}
I've attached wchar.h just in case.
--
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