c++/8378: [Windows] G++ crashes (in certain cirumstances) when returning statics
Giovanni Bajo
giovannibajo@libero.it
Wed Apr 2 02:50:00 GMT 2003
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=8378
Confirmed with cygwin 3.2. Redux:
-----------------------------------------
struct __attribute__((dllimport)) Foo
{
static int static_func();
};
int bar = Foo::static_func();
int Foo::static_func()
{
return 0;
}
-----------------------------------------
$ g++ -c pr8378.cpp
pr8378.cpp: In static member function `static int Foo::static_func()':
pr8378.cpp:12: Internal compiler error in rest_of_compilation, at
toplev.c:3491
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
Notice this is a regression from 2.95:
$ g++-2 -c pr8378.cpp
pr8378.cpp: In function `static int Foo::static_func()':
pr8378.cpp:10: warning: inconsistent dll linkage for `static int
Foo::static_fun
c()'. dllexport assumed.
If the definiiton of the variable "bar" is moved after the definition of the
static function, the ICE disappears and GCC 3.2 emits a warning message just
like 2.95.
Synopsis can now be changed to something more appropriate, and class too
(it's ice-on-legal-code).
Giovanni Bajo
More information about the Gcc-bugs
mailing list