Bug report

Eric Dumazet Eric.Dumazet@COSMOSBAY.COM
Tue Sep 29 06:53:00 GMT 1998


Hi all

This little C++ program is incorrectly compiled by egcs 2.91.57
It seems to be a generic bug.
(targets tested : SCOV5, sparc solaris 2.4)

#include <stdio.h>
const char * const strvar = "@(#)ident" ;
int main(int argc, char *argv[])
{
printf("%lx '%s'\n", strvar, (strvar == 0) ? "(null)" : strvar) ;
return 0 ;
}

egcs -o try try.C

The result is :

8049258 '(null)'

which is obviously wrong.

Tips:

If I have 'const char *strvar = "..." ;' it is correctly compiled.

If I use a C file instead of C++, the bug is not present.

Is this bug already known ?

Thanks

Eric Dumazet



More information about the Gcc-bugs mailing list