target/10431: improper __attribute__((dllimport)) handling

TROCHU Xavier xtrochu@yahoo.com
Mon Apr 21 22:18:00 GMT 2003


I checked your patch and it shows the same behaviour
as the previous one 
(i.e. an incorrect behaviour).

mainline can't be bootstrapped under mingw with this
patch. Notice that
stdout under mingw is declared really like this :
extern __attribute__((dllimport)) FILE * _iob[1];
and obviously,  this bug

This is the test I tried again :
================= rtest.i =============

extern __attribute__((dllimport)) int foo;
extern __attribute__((dllimport)) int foo2[];

int bar() {
    return foo;
}

int bar2(int i)  {
    int * p = &foo2[i];
    return *p;
}
==================================
with winnt.c reverted to version 1.42 (but with patch
from 1.43 to 1.44 
inserted) I get the following output,
which is correct and the same as gcc 3.2.2
================= rtest.ori.s =========
    .file    "rtest.i"
    .text
..globl _bar
    .def    _bar;    .scl    2;    .type    32;   
.endef
_bar:
    pushl    %ebp
    movl    %esp, %ebp
    movl    __imp__foo, %eax
    movl    (%eax), %eax
    popl    %ebp
    ret
..globl _bar2
    .def    _bar2;    .scl    2;    .type    32;   
.endef
_bar2:
    pushl    %ebp
    movl    %esp, %ebp
    subl    $4, %esp
    movl    8(%ebp), %eax
    sall    $2, %eax
    addl    __imp__foo2, %eax
    movl    %eax, -4(%ebp)
    movl    -4(%ebp), %eax
    movl    (%eax), %eax
    leave
    ret
====================================
with winnt.c version 1.45 (current) or 1.44 the output
is as the following.
================== rtest.new.s ==========
    .file    "rtest.i"
    .text
..globl _bar
    .def    _bar;    .scl    2;    .type    32;   
.endef
_bar:
    pushl    %ebp
    movl    %esp, %ebp
    movl    __imp__foo, %eax
    popl    %ebp
    ret
..globl _bar2
    .def    _bar2;    .scl    2;    .type    32;   
.endef
_bar2:
    pushl    %ebp
    movl    %esp, %ebp
    subl    $4, %esp
    movl    8(%ebp), %eax
    leal    0(,%eax,4), %edx
    movl    $__imp__foo2, %eax
    addl    %edx, %eax
    movl    %eax, -4(%ebp)
    movl    -4(%ebp), %eax
    movl    (%eax), %eax
    leave
    ret
======================================

I really would like to be able to help correcting this
bug, but I really 
lack a lot of knowledge of GCC internal for that.
But if you think I can help you testing thing, don't
hesitate to ask.

Greetings,

Xavier

mmitchel@gcc.gnu.org wrote:

>Synopsis: improper __attribute__((dllimport))
handling
>
>State-Changed-From-To: open->closed
>State-Changed-By: mmitchel
>State-Changed-When: Mon Apr 21 20:59:27 2003
>State-Changed-Why:
>    Fixed in GCC 3.3, GCC 3.4.
>
>http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10431
>
>  
>


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com



More information about the Gcc-bugs mailing list