Cygwin prolog generation emitting __alloca as a regular function call

Fish fish@infidels.org
Fri Nov 29 17:54:00 GMT 2002


 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Windows 2000 Pro SP3
Cygwin 1.3.16-1
gcc 3.2-3

Source file, compiler o/p listing and console log attached (Windows
.zip format).


fish@foobar ~/fishtest
$ cat fish.c
#include <stdio.h>
#include <string.h>

void foo ()
{
    char a[15000];
    a[0]=0;
    printf("String length=%d\n",strlen(a));
    memset( &a[0], 0xCD, 13371 );
    a[13371]=0;
    printf("String length=%d\n",strlen(a));
}

int main ( int argc, char* argv[] )
{
    foo();
    return 0;
}

fish@foobar ~/fishtest
$ gcc -march=i686 -g -O2 -fomit-frame-pointer -c fish.c
- -Wa,-adhln=fish.c.listi
ng.txt

fish@foobar ~/fishtest
$ gcc -march=i686 -g -O2 -fomit-frame-pointer -o fish.exe fish.o

fish@foobar ~/fishtest
$ fish
String length=2

fish@foobar ~/fishtest
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure
- --enable-languages=c,c++,f77,ja
va --enable-libgcj --enable-threads=posix --with-system-zlib
- --enable-nls --with
out-included-gettext --enable-interpreter --disable-sjlj-exceptions
- --disable-ve
rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux
- --host=i686-pc
- -cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr
- --exec-prefix=/usr
- --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include
- --libexecd
ir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)

fish@foobar ~/fishtest
$ uname -a
CYGWIN_NT-5.0 foobar 1.3.16(0.65/3/2) 2002-11-22 22:18 i686 unknown

fish@foobar ~/fishtest
$


- -- 
"Fish" (David B. Trout)
   fish@infidels.org



> -----Original Message-----
> From: uweigand2000 [mailto:weigand@informatik.uni-erlangen.de]
> Sent: Wednesday, November 27, 2002 6:05 pm
> To: hercules-390@yahoogroups.com
> Subject: [hercules-390] Re: gcc optimzation bug then? (was: More
> gcc (Cygwin?) memset weirdness (gcc compiler bug?))
> 
> 
> This would appear to be a gcc bug.  Specifically, what appears  
> to happen here is that instruction scheduling moves the leal  
> across the call to __alloca.  This in turn is caused by a bug  
> in the cygwin prolog generation code that emits the __alloca  
> call as a regular function call.  
>   
> As regular function calls do not change the stack pointer, the  
> instruction scheduling pass concluded that it was save to move  
> the leal 16(%esp),%edi across the call (%edi is preserved  
> across calls as well).  
>   
> Instead, the __alloca call should have been annotated to  
> express the fact that it changes %esp in a special way.  
> How to best fix this I'd leave to the i386 backend maintainers;  
> please report this bug (with testcase and explanation) to the  
> gcc bug-tracking system.  
>   
> (From what I can see, the same bug exists unchanged in gcc 3.2.1  
> and the current pre-3.3 sources.  As this particular code path  
> is only used for cygwin, it probably wasn't noticed earlier ...)  
>   
> Bye,  
> Ulrich  
>   
> --  
>   Dr. Ulrich Weigand  
>   weigand@informatik.uni-erlangen.de  
> 

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4

iQA/AwUBPeZ8kUj11/TE7j4qEQKdAwCfVWHgHT4o0jbcosrFZTuidpAM5WwAoKwk
uOEorG+NiBY2MOMVUxi4bUla
=eJTf
-----END PGP SIGNATURE-----
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fish.zip
Type: application/octet-stream
Size: 2735 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021129/8be8a547/attachment.obj>


More information about the Gcc-bugs mailing list