- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In section 6.7.8 of the C99 draft document defines :
If an attempt is made to use pointer variable p to modify the contents of the array, the behavior is undefined.
When executing the testcase below, icc does not report an error or modify the value of the variable NISLParameter0 while other compilers such as gcc and clang report runtime errors: “Segmentation fault”. I think it would be better for intelc to throw an error or at least a warning for the wrong action.
The OS is:
Linux version 4.15.0-65-generic
The GCC version in path is :
gcc (GCC) 7.3.0
TestCase:
#include<stdio.h>
char *function(char *buf){
int i = 5;
buf[5] = '1';
return buf;
}
int main(void){
char *NISLParameter0 = "abcdefghij";
char *NISLParameter1 = function(NISLParameter0);
printf("%s\n", NISLParameter1);
return 0;
}
Compiler Version:
icc (ICC) 19.0.4.243 20190416
Output:
abcdefghij
Expected output:
Throw an error or at least a warning.
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this issue. I've opened a case (CMPLRIL0-32347) with our Developer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for looking into this problem.
And how can i track this issue? Is intelc's bug tracking system open to the outside world?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it's for internal only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay, thank you.


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