public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/10142: gcc -m64 produces wrong code when passing struct as parameter
@ 2003-03-18 23:26 p.van-hoof
0 siblings, 0 replies; only message in thread
From: p.van-hoof @ 2003-03-18 23:26 UTC (permalink / raw)
To: gcc-gnats; +Cc: p.van-hoof
>Number: 10142
>Category: c
>Synopsis: gcc -m64 produces wrong code when passing struct as parameter
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Mar 18 23:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Peter van Hoof
>Release: 3.2.2
>Organization:
Queen's University of Belfast
>Environment:
System: SunOS scooby 5.9 Generic_112233-04 sun4u sparc SUNW,Sun-Blade-100
Architecture: sun4
host: sparc-sun-solaris2.9
build: sparc-sun-solaris2.9
target: sparc-sun-solaris2.9
configured with: /opt/temp/gcc-3.2.2/configure --prefix=/opt/local --enable-threads
>Description:
In the program below, a struct is passed as a parameter to a routine.
This is clearly done incorrectly, as demonstrated by the print statements.
This bug is triggered by the -m64 flag on the command line, even in
non-optimized mode.
This bug is present in gcc 3.2.2, as well as 3.3 and 3.4.
>How-To-Repeat:
scooby> gcc h.c
scooby> a.out
1.20e+00 25
1.20e+00 25
scooby> gcc -m64 h.c
scooby> a.out
1.20e+00 25
1.20e+00 -2147488472
scooby> cat h.c
typedef struct {
double m;
long x;
} mx;
void b(int i1,int i2,int i3,int i4,int i5,int i6,mx m)
{
printf("%.2e %ld\n",m.m,m.x);
}
int main() {
mx z={1.2, 25};
printf( "%.2e %ld\n", z.m, z.x );
b(1,2,3,4,5,6,z);
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-18 23:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-18 23:26 c/10142: gcc -m64 produces wrong code when passing struct as parameter p.van-hoof
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).