llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

call to wctob generates infinite loop

Open ahatanak opened this issue 15 years ago • 2 comments

Bugzilla Link 10179
Resolution DUPLICATE
Resolved on Jun 23, 2011 13:53
Version trunk
OS Linux
CC @efriedma-quic

Extended Description

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 }

ahatanak avatar Jun 23 '11 20:06 ahatanak

mentioned in issue llvm/llvm-project#9986

efriedma-quic avatar Nov 27 '21 06:11 efriedma-quic

*** This bug has been marked as a duplicate of bug llvm/llvm-project#9986 ***

efriedma-quic avatar Jun 23 '11 20:06 efriedma-quic