Bug 16198 - Miscompilation of GCC 3.3.x by 3.4.x
Summary: Miscompilation of GCC 3.3.x by 3.4.x
Status: RESOLVED DUPLICATE of bug 16195
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-25 12:25 UTC by Jakub Jelinek
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target: ppc64-redhat-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2004-06-25 12:25:46 UTC
The following testcase distilled from ggc-common.c in GCC 3.3.4 is miscompiled
on ppc64.  It loads a floating point value (70.0) into the pic register and
dereferences it, thus the testcase segfaults.

/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-mminimal-toc" { target powerpc64-*-* } } */

extern void abort (void);
extern void exit (int);

double __attribute__((noinline))
foo (void)
{
  return 16441577472.0;
}

double __attribute__((noinline))
bar (double x)
{
  return x;
}

int __attribute__((noinline))
test (void)
{
  double x = foo ();
  x = bar (x);
  x /= 1024 * 1024 * 1024;
  x *= 70;
  x = x < 70 ? x : 70;
  x += 30;
  return x;
}

int main (void)
{
  if (test () != 100)
    abort ();
  exit (0);
}
Comment 1 Jakub Jelinek 2004-06-25 12:27:41 UTC
Oops, sorry.

*** This bug has been marked as a duplicate of 16195 ***