This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Fwd: GCC 3.1/3.1.1/3.2(?) bug
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Kelledin <kelledin at users dot sourceforge dot net>
- Cc: "<gcc at gcc dot gnu dot org>;" <gcc-bugs at gcc dot gnu dot org>
- Date: Tue, 13 Aug 2002 13:13:46 -0700
- Subject: Re: Fwd: GCC 3.1/3.1.1/3.2(?) bug
- References: <200208130603.46531.kelledin@users.sourceforge.net>
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.