david@TERA.COM (David Callahan) (11/27/89)
Config.g++ sun3-nfp-os4.
A goto crosses initialization of compiler generated temporary which
generates an error messages and aborts compilation.
A work-around is to wrap the assignment in "a" in braces.
--------- file: gnu-bug1.c ----------
struct temp {
int i ;
temp() ;
temp operator+(temp&) ;
} ;
extern int test() ;
extern "C" int exit(int) ;
main() {
temp a,b,c,d ;
if(test()) goto done ;
a = b+c+d ;
done:
exit(1) ;
}
----------- Sample compilation -----------
cd /home/tera/david/Cfront/
g++ -v -c gnu-bug1.c
gcc version 1.36.1 (based on GCC 1.36)
/usr/local/lib/g++-1.36.1/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Dmc68020 gnu-bug1.c /usr/tmp/cca00984.cpp
GNU CPP version 1.36
/usr/local/lib/g++-1.36.1/gcc-cc1plus /usr/tmp/cca00984.cpp -quiet -dumpbase gnu-bug1.c -version -o /usr/tmp/cca00984.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -mbitfield
gnu-bug1.c: In function int main ():
gnu-bug1.c:15: invalid jump to label `done'
gnu-bug1.c:14: crosses initialization of `_$tmp_0'
Compilation exited abnormally with code 1 at Sun Nov 26 10:31:25