Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!tera.com!david From: david@tera.com (David Callahan) Newsgroups: gnu.g++.bug Subject: bug: g++ does not allocate storage for static member. Message-ID: <8912152139.AA04817@tera.com> Date: 15 Dec 89 21:39:17 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 65 Running 1.36.1, config sun-nfp-0S4, there is bug with static elements if structures. Here is a transcript. The source file has two structure definitions. The first has a static array and the second is conditionally defined based on the preprocessor value BUG. When this second structure is not defined, g++ correctly allocates storage for the static array but fails to allocate storage when the second struct is define. --------------------- dactyl% cat temp.c struct node { static const int type_size = 6 ; static const int stmt_map[type_size] ; protected: node() { } ; } ; const int node::stmt_map[node::type_size] = { 0, 0, 0, 1, 1, 0 } ; #ifdef BUG struct expr : public node { protected: expr() { } ; } ; #endif dactyl% g++ -v -S temp.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 temp.c /usr/tmp/cca09539.cpp GNU CPP version 1.36 /usr/local/lib/g++-1.36.1/gcc-cc1plus /usr/tmp/cca09539.cpp -quiet -dumpbase temp.c -version -o temp.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 dactyl% cat temp.s #NO_APP gcc_compiled.: .globl _node$stmt_map .text .even _node$stmt_map: .long 0 .long 0 .long 0 .long 1 .long 1 .long 0 .globl _node$type_size .even _node$type_size: .long 6 dactyl% g++ -v -S -DBUG temp.c gcc version 1.36.1 (based on GCC 1.36) /usr/local/lib/g++-1.36.1/gcc-cpp -+ -v -DBUG -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Dmc68020 temp.c /usr/tmp/cca09543.cpp GNU CPP version 1.36 /usr/local/lib/g++-1.36.1/gcc-cc1plus /usr/tmp/cca09543.cpp -quiet -dumpbase temp.c -version -o temp.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 dactyl% cat temp.s #NO_APP gcc_compiled.: dactyl% ------------------