Internal error in Mingw32

Sven Sandberg ssven.geo@yahoo.com
Sun Aug 8 05:59:00 GMT 1999


Mingw32 produces an internal error with the following code:

--- foo.cc -------------

typedef struct
{
	int x;
} foo;
extern __declspec(dllimport) foo dllvariable;
foo *bar(void)
{
	return &dllvariable;
}

--- EOF(foo.cc) --------

I compile with the following command line:

	gcc -o foo.o -c foo.cc

But this seems to happen independently of command line switches. The
compiler
gives this message:

	foo.cc:4: Internal compiler error.
	foo.cc:4: Please submit a full bug report to
`egcs-bugs@egcs.cygnus.com'.
	foo.cc:4: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for
details.

It seems like this happens always in C++ when taking the address of a
struct
that is declared as being in a dll. In a C file, this code produces a
strange
warning:

	foo.c(10) Warning:  return from incompatible pointer type

Huh? It's the same pointer type...

Another similar problem that I've been having recently is that I get
errors
when assigning from a struct in a dll to a local struct, eg

--- my_file.c ----------

typedef struct
{
	int x;
} foo;
extern __declspec(dllimport) foo dllvariable;
void bar(void)
{
	foo x;
	x = dllvariable;
}

--- EOF(my_file.c) -----

I know it's not required by a C compiler to support this. Most compilers
do
support it though and again the error goes away if the variable is not
in a
dll, which indicates this is probably the same or a related bug.

I'm using egcs 1.1.2, from the following zips:
dllhelpers-0_2_5.zip
egcs-1.1.2-mingw32.zip
egcs-1_1_2-x86-win32-patches.zip
make-3_77.zip
ming.zip
w32api-0.1.5.tar.gz


Sven Sandberg


More information about the Gcc-bugs mailing list