🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Terry R. Coley Tue, 25 Aug 1992 10:33
possible bug in gcc/g++
#997
Author: Terry R. Coley
Date: Tue, 25 Aug 1992 10:33
52 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads