I don't know what I was thinking when I wrote this, but the following illegal
code (.ii, tiny testcase) causes an ICE in g++-4.0 which was not present in 3.4:

# 1 "extern-static.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "extern-static.cpp"
struct foo {
  extern static int i;
};
int main () {
  return 0;
}

The output I get is:

[EMAIL PROTECTED]:~/src$ g++-4.0 -save-temps -o extern-static extern-static.cpp
extern-static.cpp:2: error: multiple storage classes in declaration of ‘i’
extern-static.cpp:2: internal compiler error: tree check: expected var_decl or
function_decl or parm_decl, have field_decl in grokdeclarator, at cp/decl.c:8161

The several versions of gcc I have, I got as debian packages. The output of gcc
-v for my 4.0 and 3.4 builds, respectively, are:

[EMAIL PROTECTED]:~/src$ gcc-4.0 -v
Using built-in specs.
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada
--prefix=/usr --libexecdir=/usr/lib --enable-shared --with-system-zlib
--enable-nls --enable-threads=posix --without-included-gettext
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --enable-mpfr i486-linux
Thread model: posix
gcc version 4.0.0 20050125 (experimental) (Debian 4.0-0pre5)

[EMAIL PROTECTED]:~/src$ gcc-3.4 -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.4 20050305 (prerelease) (Debian 3.4.3-11)

-- 
           Summary: ICE on illegal code: "extern static" struct member
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dan dot rosen at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20646

Reply via email to