Article View: gnu.gcc.bug
Article #997possible bug in gcc/g++
From: Terry R. Coley
Date: Tue, 25 Aug 1992 10:33
Date: Tue, 25 Aug 1992 10:33
52 lines
2368 bytes
2368 bytes
The following code complains of too many initializers in aggregate
initialization under g++/gcc and not on other systems (Silicon
Graphics, Turbo C++). Removing the union allows the initialization
to succeed.
I scanned the GCC info under emacs on the system where the software is
installed and did not see this mentioned. The output from g++ -v bug.cc
is:
Reading specs from /usr/local/lib/gcc-lib/sun4-sunos4/2.2.2/specs
gcc version 2.2.2
/usr/local/lib/gcc-lib/sun4-sunos4/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix bug.cc /usr/tmp/cca05009.i
GNU CPP version 2.2.2 (sparc)
/usr/local/lib/gcc-lib/sun4-sunos4/2.2.2/cc1plus /usr/tmp/cca05009.i -quiet -dumpbase bug.cc -version -o /usr/tmp/cca05009.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
bug.cc:19: warning: excess elements in aggregate initializer
bug.cc:19: warning: excess elements in aggregate initializer
bug.cc:19: warning: excess elements in aggregate initializer
bug.cc:19: warning: excess elements in aggregate initializer
bug.cc:19: warning: excess elements in aggregate initializer
/usr/local/lib/gcc-lib/sun4-sunos4/2.2.2/as -o bug.o /usr/tmp/cca05009.s
/usr/local/lib/gcc-lib/sun4-sunos4/2.2.2/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sun4-sunos4/2.2.2 -L/usr/local/lib bug.o -lg++ -lgcc -lc -lgcc
Source:
// exproper.c++
typedef enum { BADBINOP = 0, PLUS, MINUS, MULT, DIV, POWR } binoptype;
typedef enum { BADUNOP = 0, NEG = POWR+1, SIN, COS, TAN } unoptype;
typedef struct {
char *s;
union {
binoptype bop;
unoptype uop;
};
}
op_to_charp;
op_to_charp BINOPS[] = { {"+", PLUS},
{"-", MINUS},
{"*", MULT},
{"/", DIV},
{"^", POWR} };
main() {
int dummy;
}
- Terry
terry@wag.caltech.edu 818-397-2724 818-585-0918 (FAX)
Terry Coley, Caltech 139-74, Pasadena, CA 91125
Technical Details
Message-ID:
<199208260033.AA19417@brahms.wag.caltech.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wag.caltech.edu!terryShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wag.caltech.edu!terry From: terry@wag.caltech.edu (Terry R. Coley) Subject: possible bug in gcc/g++ Message-ID: <199208260033.AA19417@brahms.wag.caltech.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 25 Aug 1992 10:33:29 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 53