stpncpy broken on OS X with icc version 12.1.5

stpncpy broken on OS X with icc version 12.1.5

Аватар пользователя Marc Lavergne
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? 
2 posts / 0 новое
Последнее сообщение
Пожалуйста, обратитесь к странице Уведомление об оптимизации для более подробной информации относительно производительности и оптимизации в программных продуктах компании Intel.
Аватар пользователя Jeff Arnold (Intel)

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.

Зарегистрируйтесь, чтобы оставить комментарий.