[LLVMbugs] [Bug 3964] New: clang: undefined reference to __builtin_strcmp
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Apr 9 06:22:51 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=3964
Summary: clang: undefined reference to __builtin_strcmp
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: edwintorok at gmail.com
CC: llvmbugs at cs.uiuc.edu
Using SVN r68706 on Linux x86-64:
int main(int argc, char *argv[])
{
return __builtin_strcmp(argv[0], argv[1]);
}
$ clang x.c
/tmp/cc-84cdXS.o: In function `main':
x.c:(.text+0x2e): undefined reference to `__builtin_strcmp'
collect2: ld returned 1 exit status
This has worked until now: the above happens when expanding string.h at -O2.
So either something broke in clang, or something causes another part of
string.h to be expanded.
FWIW, strcmp(argv[0], argv[1]) is expanded to this at -O2:
extern int strcmp (__const char *__s1, __const char *__s2)
return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(argv[0]) && __builtin_constant_p (argv[1]) && (__s1_len = strlen (argv[0]),
__s2_len = strlen (argv[1]), (!((size_t)(const void *)((argv[0]) + 1) -
(size_t)(const void *)(argv[0]) == 1)|| __s1_len >= 4) && (!((size_t)(const
void *)((argv[1]) + 1) - (size_t)(const void *)(argv[1]) == 1) || __s2_len >=
4)) ? __builtin_strcmp (argv[0], argv[1]) : (__builtin_constant_p (argv[0]) &&
((size_t)(const void *)((argv[0]) + 1) - (size_t)(const void *)(argv[0]) == 1)
&& (__s1_len = strlen (argv[0]), __s1_len < 4) ? (__builtin_constant_p
(argv[1]) && ((size_t)(const void *)((argv[1]) + 1) - (size_t)(const void
*)(argv[1]) == 1) ? __builtin_strcmp (argv[0], argv[1]) : (__extension__ ({
__const unsigned char *__s2 = (__const unsigned char *) (__const char *)
(argv[1]); register int __result = (((__const unsigned char *) (__const char *)
(argv[0]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result =
(((__const unsigned char *) (__const char *) (argv[0]))[1] - __s2[1]); if
(__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *)
(__const char *) (argv[0]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0)
__result = (((__const unsigned char *) (__const char *) (argv[0]))[3] -
__s2[3]); } } __result; }))) : (__builtin_constant_p (argv[1]) &&
((size_t)(const void *)((argv[1]) + 1) - (size_t)(const void *)(argv[1]) == 1)
&& (__s2_len = strlen (argv[1]), __s2_len < 4) ? (__builtin_constant_p
(argv[0]) && ((size_t)(const void *)((argv[0]) + 1) - (size_t)(const void
*)(argv[0]) == 1) ? __builtin_strcmp (argv[0], argv[1]) : (__extension__ ({
__const unsigned char *__s1 = (__const unsigned char *) (__const char *)
(argv[0]); register int __result = __s1[0] - ((__const unsigned char *)
(__const char *) (argv[1]))[0]; if (__s2_len > 0 && __result == 0) { __result =
(__s1[1] - ((__const unsigned char *) (__const char *) (argv[1]))[1]); if
(__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char
*) (__const char *) (argv[1]))[2]); if (__s2_len > 2 && __result == 0) __result
= (__s1[3] - ((__const unsigned char *) (__const char *) (argv[1]))[3]); } }
__result; }))) : __builtin_strcmp (argv[0], argv[1])))); });
--
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