[LLVMbugs] [Bug 9557] New: return value ignored
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Mar 25 14:12:29 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9557
Summary: return value ignored
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ahatanak at gmail.com
CC: llvmbugs at cs.uiuc.edu
In the following example, main function in generated bit code does not return
0.
# .c file
/* Verify whether math functions are simplified. */
double sin(double);
double floor(double);
float
t(float a)
{
return sin(a);
}
float
q(float a)
{
return floor(a);
}
double
q1(float a)
{
return floor(a);
}
main()
{
#ifdef __OPTIMIZE__
if (t(0)!=0)
abort ();
if (q(0)!=0)
abort ();
if (q1(0)!=0)
abort ();
#endif
return 0;
}
__attribute__ ((noinline))
double
floor(double a)
{
abort ();
}
__attribute__ ((noinline))
float
floorf(float a)
{
return a;
}
__attribute__ ((noinline))
double
sin(double a)
{
abort ();
}
__attribute__ ((noinline))
float
sinf(float a)
{
return a;
}
# .ll file generated
# clang tests-c/20030125-1.c -D __OPTIMIZE__=1 -emit-llvm -O1 -S -o -
; ModuleID = 'tests-c/20030125-1.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"
define float @t(float %a) noreturn nounwind readnone {
entry:
unreachable
}
define double @sin(double %a) noreturn nounwind readnone noinline {
entry:
tail call void @abort() noreturn nounwind
unreachable
}
define float @q(float %a) noreturn nounwind {
entry:
%call = tail call double @floor(double undef)
unreachable
}
define double @floor(double %a) noreturn nounwind noinline {
entry:
tail call void @abort() noreturn nounwind
unreachable
}
define double @q1(float %a) noreturn nounwind {
entry:
%call = tail call double @floor(double undef)
unreachable
}
define i32 @main() nounwind {
entry:
unreachable
}
declare void @abort() noreturn
define float @floorf(float %a) nounwind readnone noinline {
entry:
ret float %a
}
define float @sinf(float %a) nounwind readnone noinline {
entry:
ret float %a
}
--
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