public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: janis187@us.ibm.com
To: gcc-gnats@gcc.gnu.org
Subject: target/5977: ia64 corruption in struct args passed by value
Date: Fri, 15 Mar 2002 15:56:00 -0000	[thread overview]
Message-ID: <20020315235030.21894.qmail@sources.redhat.com> (raw)


>Number:         5977
>Category:       target
>Synopsis:       ia64 corruption in struct args passed by value
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 15 15:56:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Janis Johnson
>Release:        gcc version 3.1 20020315 (prerelease)
>Organization:
>Environment:
Itanium, Red Hat Linux release 7.1.94 (Roswell)
>Description:
The 3.1 prerelease compiler for ia64-unknown-linux-gnu has
problems when passing struct arguments by value from a
function to which they were also passed by value.  This
shows up with the SPEC CPU2000 benchmark program 175.vpr,
but the test case here bears no resemblance to the
original code.

This is a regression from GCC 3.0.4.
>How-To-Repeat:
Compile the test case on ia64 with default options; when run
it will abort.
>Fix:
Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="bug.c"
Content-Disposition: inline; filename="bug.c"

/* This test case fails at runtime when compiled, with any options, with
   gcc version 3.1 20020315 (prerelease) on ia64-unknown-linux-gnu.

   It passes two structs by value to a function that then passes them by
   value to another function, in which the values of the second struct
   argument are corrupted.  */

struct S {
  int i1;
  int i2;
  int i3;
  int i4;
  int i5;
  int i6;
  int i7;
  int i8;
  int i9;
};

struct S gs1, gs2;

void
init (struct S *p, int i)
{
  p->i1 = 1 + i;
  p->i2 = 2 + i;
  p->i3 = 3 + i;
  p->i4 = 4 + i;
  p->i5 = 5 + i;
  p->i6 = 6 + i;
  p->i7 = 7 + i;
  p->i8 = 8 + i;
  p->i9 = 9 + i;
}

void
check (struct S *p, int i)
{
  if (p->i1 != 1 + i) abort ();
  if (p->i2 != 2 + i) abort ();
  if (p->i3 != 3 + i) abort ();
  if (p->i4 != 4 + i) abort ();
  if (p->i5 != 5 + i) abort ();
  if (p->i6 != 6 + i) abort ();
  if (p->i7 != 7 + i) abort ();
  if (p->i8 != 8 + i) abort ();
  if (p->i9 != 9 + i) abort ();
}

void
bar (struct S s1, struct S s2)
{
  check (&s1, 10);
  check (&s2, 20);
}

void
foo (struct S s1, struct S s2)
{
  bar (s1, s2);
}

int
main ()
{
  init (&gs1, 10);
  check (&gs1, 10);
  init (&gs2, 20);
  check (&gs2, 20);
  foo (gs1, gs2);

  exit (0);
}


             reply	other threads:[~2002-03-15 23:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-15 15:56 janis187 [this message]
2002-03-16  1:14 jakub
2002-03-17 13:36 jakub
2002-03-19 14:26 rth

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=20020315235030.21894.qmail@sources.redhat.com \
    --to=janis187@us.ibm.com \
    --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).