Function taking struct within struct

Dave Morrison dave@bnl.gov
Sat May 9 07:26:00 GMT 1998


Hi -

Under Linux, using egcs built from the latest CVS snapshots, the code
fragment below generates ICE, while gcc-2.7.2 does not:

#ifdef EXAMPLE
typedef struct {} inner;
#else
struct inner {};
#endif

struct outer { inner i; };

extern void sub (inner);

int func (outer optr) {
  sub(optr.i);
}

48% g++ -v
Reading specs from
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.27/specs
gcc version egcs-2.91.27 19980502 (gcc2 ss-980502 experimental)
49% g++ -c prog.C -DEXAMPLE
prog.C: In function `int func(struct outer)':
prog.C:12: Internal compiler error.
prog.C:12: Please submit a full bug report to `egcs-bugs@cygnus.com'.
50% /usr/bin/g++ -v
 /usr/bin/gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs
gcc version 2.7.2.3
51% /usr/bin/g++ -c prog.C -DEXAMPLE
52% uname -mrspv
Linux 2.0.33 #6 Sun Apr 12 13:17:08 EDT 1998 i686 unknown

If `EXAMPLE' is not defined, the fragment compiles with either compiler.

Dave

-- 
David Morrison  Brookhaven National Laboratory  phone: 516-344-5840
                Physics Department, Bldg 510 C    fax: 516-344-3253
		          Upton, NY 11973-5000  email: dave@bnl.gov



More information about the Gcc-bugs mailing list