Article View: gnu.gcc.bug
Article #1235Structure passing bug
From: Steve Linton
Date: Wed, 30 Sep 1992 06:35
Date: Wed, 30 Sep 1992 06:35
40 lines
1205 bytes
1205 bytes
A bug seems sometimes to occurr when passing a alrge structure as an argument.
For example the following does not suceed on a Sun4 under gcc 2.1 or 2.2.2,
at any optimization level.
struct a {int b[7];};
void f(struct a x)
{
int i;
for (i=0; i < 7; i++)
printf("%d\t",x.b[i]);
putc('\n');
}
main()
{
struct a y;
int i;
for (i = 0; i < 7; i++)
y.b[i] = i;
f(y);
}
Under gdb, the argument passed to f appears as
(gdb) next
17 f(y);
(gdb) print y
$1 = {b = {0, 1, 2, 3, 4, 5, 6}}
(gdb) step
f (x={b = {285216903, 8252, 8256, -16777207, 9, -16777207, -132531200}})
at test.c:6
6 for (i=0; i < 7; i++)
Is this a known problem? Is there a fix?
Please reply by mail
Steve Linton
Technical Details
Message-ID:
<1992Sep30.063519.11398@infodev.cam.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!emu.pmms.cam.ac.uk!sl25Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!emu.pmms.cam.ac.uk!sl25 From: sl25@emu.pmms.cam.ac.uk (Steve Linton) Subject: Structure passing bug Message-ID: <1992Sep30.063519.11398@infodev.cam.ac.uk> Sender: gnulists@ai.mit.edu Organization: Cambridge University DPMMS Distribution: gnu Date: Wed, 30 Sep 1992 06:35:19 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 41