[LLVMbugs] [Bug 10179] New: call to wctob generates infinite loop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 23 11:18:33 PDT 2011


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

           Summary: call to wctob generates infinite loop
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ahatanak at gmail.com
                CC: llvmbugs at cs.uiuc.edu


An infinite loop is created when the code shown below is compiled with clang. 

$ clang infloop2.c  -O3 -S -o infloop2.O3.ll -emit-llvm
$ clang infloop2.c  -O1 -S -o infloop2.O1.ll -emit-llvm

// infloop2.c
#include <wchar.h>

int f (int i)
{
  return  wctob (i);
}

// infloop2.O3.ll
; ModuleID = 'infloop2.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-unknown-linux-gnu"

define i32 @f(i32 %i) nounwind uwtable readnone {
entry:
  br label %tailrecurse.i

tailrecurse.i:                                    ; preds = %tailrecurse.i,
%entry
  br label %tailrecurse.i
}

// infloop2.O1.ll
; ModuleID = 'infloop2.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-unknown-linux-gnu"

define i32 @f(i32 %i) nounwind uwtable readnone {
entry:
  %call = tail call i32 @wctob(i32 %i) nounwind
  ret i32 %call
}

define available_externally i32 @wctob(i32 %__wc) nounwind uwtable readnone
inlinehint {
entry:
  br label %tailrecurse

tailrecurse:                                      ; preds = %tailrecurse,
%entry
  br label %tailrecurse
}

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