This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

target/5977: ia64 corruption in struct args passed by value



>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);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]