Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

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

Dmitry_A_1
Beginner
387 Views
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.

0 Kudos
2 Replies
JenniferJ
Moderator
387 Views

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

0 Kudos
Dmitry_A_1
Beginner
387 Views
:-) 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... */ })


0 Kudos
Reply