This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/5351: function pass-by-value structure copy corrupts structure on stack
- From: bangerth at dealii dot org
- To: awk at localhost dot localdomain, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 5 Nov 2002 16:05:53 -0000
- Subject: Re: c/5351: function pass-by-value structure copy corrupts structure on stack
- Reply-to: bangerth at dealii dot org, awk at localhost dot localdomain, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: function pass-by-value structure copy corrupts structure on stack
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Nov 5 08:05:52 2002
State-Changed-Why:
I can reproduce this with 3.2.1pre, but it seems fixed in
present CVS. However, since this is a regression w.r.t.
2.95, I leave it open and put it into "high". A reduced
testcase is this:
----------------------------------
#include <stdio.h>
#include <string.h>
struct X {
char s[100];
};
void foo(struct X x) {
printf("x.s: %s\n", x.s);
}
int main() {
struct X x;
strcpy(x.s, "this is a test string");
foo(x);
}
-------------------------------------
With 3.2.1pre I get
tmp/g> /home/bangerth/bin/gcc-3.2.1-pre/bin/gcc x.c
tmp/g> ./a.out
x.s: Äñÿ¿Ôa@st string
This is not what I want to see.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5351