- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to do the process of cutting off the code at the end of the string.
The if part in the list below is omitted.(-O1 and -O2)
I want to switch from icc to icx, but I can't do it with this.
ps.
a. Does not occur in version (2021.4.0.20210924).
b. Please also fix the fact that the -finline option does not work with -O0.
・string.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
int main(void)
{
char string[]={"Language ,1\n"};
char *buffer = malloc(1024 * 3);
char *label,*data;
int len;
char delims[2];
strcpy(buffer,string);
// divide into tokens
delims[0]=',';
delims[1]='\0';
if(NULL==(label=strtok(buffer, delims))) return -6;
if(NULL==(data =strtok(NULL, delims))) return -5;
len = strlen(data);
if(data[len - 1] == '\n') data[len - 1] = '\0'; // <= omit
printf("[%s]\n",label);
printf("[%s]\n",data);
return 0;
}
・icx abnomal
>:~/user$ icx -O2 string.c -o string
>:~/user$ ./string (result)
[Language ]
[1 <- line feed remains
]
・icc (and gcc) is correct
>:~/user$ icc -O2 string.c -o string -diag-disable=1044
>:~/user$ ./string (result)
[Language ]
[1]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in the Intel forums.
Thanks for reporting this issue. We were able to reproduce it on our end and we have informed the development team about it.
Thanks & Regards
Shivani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your patience. The issue raised by you has been fixed in the 2023.1 version which will be released in the coming months. If the issue still persists with the new release, then you can start a new discussion for the community to investigate.
Thanks & Regards
Shivani
![](/skins/images/7FC17B7B85029576C25F1E43CE255B51/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page