c++/9579: [MingW] Unable to compile DLL using mingw32-g++ 3.2.1 on Windows 2000

Danny Smith dannysmith@clear.net.nz
Thu Feb 6 03:59:00 GMT 2003


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=g
cc&pr=9579

This is still a bug on trunk.
Here is minimal testcase showing bug:
I believe there are several other PR's closely related if not identical
to this.

Note: The ICE is seen only with C++,  However, although it compiles as
C, the output
is incorrect, in that the dllimport attribute is not overrriden.

/* dllimport.C  */

/* Declare as dllimport */
__attribute__((dllimport)) void foo(void);

/* if the definition comes before use, everything is fine */
#ifdef DEFINEFIRST
/* Define it:  This should override the dllimport attribute */
void foo(void) {}
#endif

void bar(void)
{
  foo(); /* Use it: This will call _imp__foo, not foo, unless dllimport
is overriden */
}

#ifndef DEFINEFIRST
/* Define it:  This should override the dllimport attribute */
void foo(void) {}
#endif

gcc -S dllimport.C
dllimport.C: In function `void foo()':
dllimport.C:19: internal compiler error: in rest_of_compilation, at
toplev.c:
   3601


gcc -S -DDEFINEFIRST dllimport.C compiles fine.


Danny



More information about the Gcc-bugs mailing list