This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fwd: GCC 3.1/3.1.1/3.2(?) bug


On Tue, Aug 13, 2002 at 06:04:15AM -0500, Kelledin wrote:
> Just wanted to kick this off to you guys, in case you haven't 
> discovered it already.  It appears to affect all versions of gcc 
> >=3.1.  The thread about this really starts here:
> 
> http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0350.html
> 
> ----------  Forwarded Message  ----------
> 
> Subject: Re: kbd miscompilation - found out why...
> Date: Tue, 13 Aug 2002 05:30:03 -0500
> From: Kelledin <kelledin+LFS@skarpsey.dyndns.org>
> To: lfs-dev@linuxfromscratch.org
> 
> The good news, i found the problem.
> 
> The bad news, it's a gcc bug. =(
> 
> The problem appears to be that when a struct with a static char
> array (either signed or unsigned char) is passed to a function
> (not a struct pointer, but the struct itself, is passed to the
> function), the contents get miscopied.  This only happens if the
> app is compiled for cpu i686 or greater; optimization level
> appears to make no difference.  It does not appear to happen
> with static arrays of other types, such as int or float.
> 
> Test case is below:
> 
> --Begin
>  testcase.c-----------------------------------------------
>  #include <stdio.h>
> 
> struct abba {
>     char str[128];
> };
> 
> void test(struct abba ke)
> {
>     printf("%s\n", ke.str);
> }
> 
> int main()
> {
>     struct abba ke;
> 
>     strcpy(ke.str, "DOH");
>     test(ke);
> }
> --End

-maccumulate-outgoing-args seems to be the problem.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]