[BUG ?] internal error: assertion failed at: "shared/edgcpfe/statements.c", line 2341

[BUG ?] internal error: assertion failed at: "shared/edgcpfe/statements.c", line 2341

While compiling the following program with 'icc -c':
----
#define NEXT_LINE(c)
({
while ((*(c) != '') && (*(c) != '
') && (*(c) != '
')) {
(c)++;
}
if (*(c) == '
') {
(c)++;
} else if (*(c) == '
') {
(c)++;
if (*(c) == '
') {
(c)++;&nbs
p;
} else {
return -1;
}
}
})

int parse (const char *text)
{
const char *c = text;
const unsigned int TEMPCHARS = 6;
char buf[TEMPCHARS][96];

NEXT_LINE(c);
return 0;
}
----
the compiler fails with the message:

icc-fail.c(24): internal error: assertion failed at: "shared/edgcpfe/statements.c", line 2341

NEXT_LINE(c);
^

compilation aborted for icc-fail.c (code 4)

This happens on Linux with the compiler version 9.1.045. GNU C 4.1.1 handles this code without any problems.

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

I'm able to duplicate the problem. The work around is to remove the variable array or remove the "return -1;" in the define.

If you haven't created an issue at PremierSupport, please do so. I'll create a tracker to the compiler.

Thanks,

Jennifer

:-) this is not a workaround.

Real workaround is to define NEXT_LINE as usual

#define NEXT_LINE(c) do { /* ...stuff... */ } while (0)

instead of using non-ISO (but widely used by GNU) statement expression:

#define NEXT_LINE(c) ({ /* ...stuff... */ })

Leave a Comment

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