[LLVMbugs] [Bug 10628] New: clang fails test 20071210-1.c with -O2 and -O3
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 9 16:58:28 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10628
Summary: clang fails test 20071210-1.c with -O2 and -O3
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
Execution fails (aborts) when the attached program is compiled with -O2 or -O3.
Upon inspection of the produced bitcode, I found the expression in line 62 of
the source program evaluates to false, and as a result, abort() is called
unconditionally.
$ clang gcc-4.4.6/gcc/testsuite/gcc.c-torture/execute/20071210-1.c -O2
-emit-llvm -S -o -
define i32 @main() nounwind uwtable {
entry:
%t = alloca [2 x i8*], align 16
%s = alloca [6 x i32], align 16
%call = call i8** @bar(i8** null, i32* null)
%arrayinit.begin = getelementptr inbounds [2 x i8*]* %t, i64 0, i64 0
%arrayidx = getelementptr inbounds i8** %call, i64 2
%tmp1 = load i8** %arrayidx, align 8, !tbaa !0
store i8* %tmp1, i8** %arrayinit.begin, align 16, !tbaa !0
%arrayinit.element = getelementptr inbounds [2 x i8*]* %t, i64 0, i64 1
%arrayidx3 = getelementptr inbounds i8** %call, i64 4
%tmp4 = load i8** %arrayidx3, align 8, !tbaa !0
store i8* %tmp4, i8** %arrayinit.element, align 8, !tbaa !0
%tmp6 = bitcast [6 x i32]* %s to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp6, i8* bitcast ([6 x i32]*
@main.s to i8*), i64 24, i32 16, i1 false)
%arrayidx7 = getelementptr inbounds [6 x i32]* %s, i64 0, i64 1
%call8 = call i8** @bar(i8** %arrayinit.begin, i32* %arrayidx7)
call void @abort() noreturn nounwind
unreachable
}
$ clang gcc-4.4.6/gcc/testsuite/gcc.c-torture/execute/20071210-1.c -O1
-emit-llvm -S -o -
define i32 @main() nounwind uwtable {
entry:
%t = alloca [2 x i8*], align 16
%s = alloca [6 x i32], align 16
%call = call i8** @bar(i8** null, i32* null)
%arrayinit.begin = getelementptr inbounds [2 x i8*]* %t, i64 0, i64 0
%arrayidx = getelementptr inbounds i8** %call, i64 2
%tmp1 = load i8** %arrayidx, align 8, !tbaa !0
store i8* %tmp1, i8** %arrayinit.begin, align 16, !tbaa !0
%arrayinit.element = getelementptr inbounds [2 x i8*]* %t, i64 0, i64 1
%arrayidx3 = getelementptr inbounds i8** %call, i64 4
%tmp4 = load i8** %arrayidx3, align 8, !tbaa !0
store i8* %tmp4, i8** %arrayinit.element, align 8, !tbaa !0
%tmp6 = bitcast [6 x i32]* %s to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp6, i8* bitcast ([6 x i32]*
@main.s to i8*), i64 24, i32 16, i1 false)
%arrayidx7 = getelementptr inbounds [6 x i32]* %s, i64 0, i64 1
%call8 = call i8** @bar(i8** %arrayinit.begin, i32* %arrayidx7)
%cmp = icmp eq i8** %call8, null
br i1 %cmp, label %lor.lhs.false, label %if.then
--
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