[LLVMbugs] [Bug 14618] New: Miscompilation of pow() & sqrt() from musl libc's tgmath.h
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Dec 16 21:26:17 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14618
Bug #: 14618
Summary: Miscompilation of pow() & sqrt() from musl libc's
tgmath.h
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ojab at ojab.ru
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9711
--> http://llvm.org/bugs/attachment.cgi?id=9711
Testcase
clang cannot compile pow() and sqrt() functions from musl libc's [1] tgmath.h,
reduced testcase can be found in the attached file.
Just FYI: gcc also fails to build the testcase since 4.5
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55695):
clang version 3.3 (trunk 170294)
Target: x86_64-unknown-linux-gnu
Thread model: posix
/tmp/retcast.c:38:7: warning: cast to 'void *' from smaller integer type 'int'
[-Wint-to-pointer-cast]
x = xpow(2,2);
^
/tmp/retcast.c:33:26: note: expanded from macro 'xpow'
#define xpow(x,y) __tg_real_complex_pow((x), (y))
^
/tmp/retcast.c:24:38: note: expanded from macro '__tg_real_complex_pow'
#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
^
/tmp/retcast.c:17:3: note: expanded from macro '__RETCAST_2'
(void *)!((!__IS_FP(x) || !__IS_FP(y)) &&
__FLT((x)+(y)+1.0f))))0 : \
^
/tmp/retcast.c:38:7: warning: cast to 'void *' from smaller integer type 'int'
[-Wint-to-pointer-cast]
/tmp/retcast.c:33:26: note: expanded from macro 'xpow'
#define xpow(x,y) __tg_real_complex_pow((x), (y))
^
/tmp/retcast.c:24:38: note: expanded from macro '__tg_real_complex_pow'
#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
^
/tmp/retcast.c:21:3: note: expanded from macro '__RETCAST_2'
(void *)((!__IS_FP(x) || !__IS_FP(y)) && (__FLT((x)+(y)+1.0f)
|| __FLTCX((x)+(y))))))0 )))
^
/tmp/retcast.c:38:5: error: assigning to 'double' from incompatible type
'typeof (*(0 ? (typeof (0 ?
(double *)0 : (void *)!((!!!((1 ? 1 : ((2))) / 2) || !!!((1 ? 1 : ((2)))
/ 2)) && ((!!((1 ? 1 :
(((2)) + ((2)) + 1.F)) / 2) && 2 * sizeof (((2)) + ((2)) + 1.F) == sizeof
((((2)) + ((2)) + 1.F) +
(__extension__ 1.Fi))) && sizeof (((2)) + ((2)) + 1.F) ==
sizeof(float)))))0 : 0 ? (typeof (0 ?
(_Complex double *)0 : (void *)!((!!!((1 ? 1 : ((2))) / 2) || !!!((1 ? 1
: ((2))) / 2)) && ((!!((1 ?
1 : (((2)) + ((2)))) / 2) && sizeof (((2)) + ((2))) == sizeof ((((2)) +
((2))) +
(__extension__ 1.Fi))) && sizeof (((2)) + ((2))) == sizeof(_Complex
float)))))0 : (typeof (0 ?
(typeof (((2)) + ((2))) *)0 : (void *)((!!!((1 ? 1 : ((2))) / 2) ||
!!!((1 ? 1 : ((2))) / 2)) &&
(((!!((1 ? 1 : (((2)) + ((2)) + 1.F)) / 2) && 2 * sizeof (((2)) + ((2)) +
1.F) == sizeof
((((2)) + ((2)) + 1.F) + (__extension__ 1.Fi))) && sizeof (((2)) + ((2))
+ 1.F) == sizeof(float)) ||
((!!((1 ? 1 : (((2)) + ((2)))) / 2) && sizeof (((2)) + ((2))) == sizeof
((((2)) + ((2))) +
(__extension__ 1.Fi))) && sizeof (((2)) + ((2))) == sizeof(_Complex
float))))))0))' (aka 'void')
x = xpow(2,2);
^ ~~~~~~~~~
2 warnings and 1 error generated.
[1] http://www.musl-libc.org/
--
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