- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given the following test case on OS X:
#include
#include
int main(int argc, const char * argv[])
{
char data1[8] = "foo";
char data2[16] = "helloworld";
// links and works
// char* ptr = stpcpy(data1, data1);
// links and works
// char* ptr = strncpy(data1, data2, sizeof(data1));
// doesn't link (Undefined symbols for architecture x86_64)
char* ptr = stpncpy(data1, data2, sizeof(data1));
printf("%s\\n", data1);
return 0;
}
I get the following:
# icc main.c
main.c(16): warning #42: operand types are incompatible ("int" and "char *")
char* ptr = stpncpy(data1, data2, sizeof(data1));
^
Undefined symbols for architecture x86_64:
"___builtin___stpncpy_chk", referenced from:
_main in icczDRt9N.o
ld: symbol(s) not found for architecture x86_64
The same code works fine under ICC for Linux. Since stpncpy is a part of libc, I'm assuming that this is a known bug in ICC for OS X?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FWIW, I don't see any errors when compiling with
Intel® C Intel® 64 Compiler XE for applications running on Intel® 64, Version 12.1.6.367 Build 20120612
or
Intel® C Intel® 64 Compiler XE for applications running on Intel® 64, Version 13.0.0.088 Build 20120731
on Mac OS 10.8. The command line was simply "icc test.cpp"
Both produce
hellowor??
when I run the resulting a.out.
Intel® C Intel® 64 Compiler XE for applications running on Intel® 64, Version 12.1.6.367 Build 20120612
or
Intel® C Intel® 64 Compiler XE for applications running on Intel® 64, Version 13.0.0.088 Build 20120731
on Mac OS 10.8. The command line was simply "icc test.cpp"
Both produce
hellowor??
when I run the resulting a.out.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page