stpncpy broken on OS X with icc version 12.1.5

stpncpy broken on OS X with icc version 12.1.5

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.old: symbol(s) not found for architecture x86_64The 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? 

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today