public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: p.van-hoof@qub.ac.uk
To: gcc-gnats@gcc.gnu.org
Cc: p.van-hoof@qub.ac.uk
Subject: c/10142: gcc -m64 produces wrong code when passing struct as parameter
Date: Tue, 18 Mar 2003 23:26:00 -0000	[thread overview]
Message-ID: <200303182319.h2INJt4D002990@scooby.star.fleet> (raw)


>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:


                 reply	other threads:[~2003-03-18 23:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200303182319.h2INJt4D002990@scooby.star.fleet \
    --to=p.van-hoof@qub.ac.uk \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).