c++/7103: Internal compiler error with mingw-gcc-3.1

Danny Smith dannysmith@clear.net.nz
Thu Dec 19 23:56:00 GMT 2002


The following reply was made to PR c++/7103; it has been noted by GNATS.

From: Danny Smith <dannysmith@clear.net.nz>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, sym_phon5@hotmail.com,
 gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/7103: Internal compiler error with mingw-gcc-3.1
Date: Fri, 20 Dec 2002 07:49:31 +0000

 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
 



More information about the Gcc-prs mailing list