- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$ icc -O -fno-builtin -opt-report -opt-report-phasehlo bug.c -o exe1
HLO REPORT LOG OPENED ON Sun Jan 14 20:58:12 2007
High Level Optimizer Report (main)
High Level Optimizer Report (bazooka)
$ icc -O -fbuiltin -opt-report -opt-report-phasehlo bug.c -o exe2
HLO REPORT LOG OPENED ON Sun Jan 14 20:58:21 2007
High Level Optimizer Report (main)
Loop at line:31 memcopy(with guard) generated
Loop at line:32 memcopy(with guard) generated
High Level Optimizer Report (bazooka)
Loop at line:20 memcopy(with guard) generated
$ ./exe1
34
$ ./exe2
v@
$ cat bug.c
/*
* compile and run:
* icc-9.1.045 -O -fbuiltin bug.c
* icc-9.1.045 -O -fno-builtin bug.c
*/
#include
char str[10] = "1234567";
int pos = 4;
void bazooka(int to, int from)
{
char buf[10], *cp = buf;
if (from < pos) {
from = pos;
}
if (from < to) {
from -= pos;
to -= pos;
do {
*cp++ = str[from];
} while (++from < to);
}
*cp = '';
fputs(buf, stdout);
}
int main(void)
{
bazooka(7,6);
bazooka(8,7);
return 0;
}
HLO REPORT LOG OPENED ON Sun Jan 14 20:58:12 2007
High Level Optimizer Report (main)
High Level Optimizer Report (bazooka)
$ icc -O -fbuiltin -opt-report -opt-report-phasehlo bug.c -o exe2
HLO REPORT LOG OPENED ON Sun Jan 14 20:58:21 2007
High Level Optimizer Report (main)
Loop at line:31 memcopy(with guard) generated
Loop at line:32 memcopy(with guard) generated
High Level Optimizer Report (bazooka)
Loop at line:20 memcopy(with guard) generated
$ ./exe1
34
$ ./exe2
v@
$ cat bug.c
/*
* compile and run:
* icc-9.1.045 -O -fbuiltin bug.c
* icc-9.1.045 -O -fno-builtin bug.c
*/
#include
char str[10] = "1234567";
int pos = 4;
void bazooka(int to, int from)
{
char buf[10], *cp = buf;
if (from < pos) {
from = pos;
}
if (from < to) {
from -= pos;
to -= pos;
do {
*cp++ = str[from];
} while (++from < to);
}
*cp = '';
fputs(buf, stdout);
}
int main(void)
{
bazooka(7,6);
bazooka(8,7);
return 0;
}
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume you're trying to point out that you get bad results in the second case, when using -fbuiltin (the default at most opt levels). I get slightly different results, but I do see what I believe to be the same problem, so I've logged a bug in our bug tracking system. I'll post here again when I get more info or when the bug is fixed.
Thanks for pointing out the problem and providing a concise test case, that's most helpful!
Dale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem appears to be fixed in the 10.0 beta.
Dale
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