This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7103: Internal compiler error with mingw-gcc-3.1
- From: Danny Smith <dannysmith at clear dot net dot nz>
- To: gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, sym_phon5 at hotmail dot com,gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: Fri, 20 Dec 2002 07:49:31 +0000
- Subject: Re: c++/7103: Internal compiler error with mingw-gcc-3.1
- Reply-to: Danny Smith <dannysmith at users dot sourceforge dot net>
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=g
cc&pr=7103
Correction to last message:
Gcc-2.95 did compile this testcase code without error.
===========================================
/* Declare as import from dll */
extern __attribute__((dllimport)) void foo(void);
/* Use it */
int bar(void)
{
foo();
}
/* Define it.
The definition should override the dllimport attribute */
void foo (void){}
===========================================
However, the results of compilation with 2.95 would cause a link
failure. Here is the assembler output with 2.95 (using C ). Linking
this file would cause undefined reference to __imp__foo (ie, foo
declared as dllimport). So the bug is really that the compiler now ICES
rather than outputting a warning or error (which it didn't do in 2.95
either).:
.file "dllimport.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
.align 4
.globl _bar
.def _bar; .scl 2; .type 32; .endef
_bar:
pushl %ebp
movl %esp,%ebp
subl $20,%esp
pushl %ebx
movl __imp__foo,%ebx <<< undefined symbol with dllimport decoration
call *%ebx
L2:
movl -24(%ebp),%ebx
movl %ebp,%esp
popl %ebp
ret
.align 4
.globl _foo
.def _foo; .scl 2; .type 32; .endef
_foo:
pushl %ebp
movl %esp,%ebp
L3:
movl %ebp,%esp
popl %ebp
ret
Danny