This is the mail archive of the gcc@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]

patch that caused regression PR c/7949


The regression reported in PR c/7949 showed up starting
with this patch:

Tue Feb 19 12:37:23 CET 2002  Jan Hubicka  <jh@suse.cz>

	* regmove.c (regmove_optimize): Avoid increasing of register pressure.

Here's the test case from the PR that I used on i686-linux:

-------------------
/* Incorrect results when compiled with -O2 with 3.1 or later */

double rvals(int v)
{
  union a {
    double d;
    unsigned int i[2];
  } aa;

  if (v == 0) {
    /* Return maximum double */
    /* For bigendian machines swap i[0] and i[1] */
    aa.i[0] = 0xffffffff;
    aa.i[1] = 0x7fefffff;
  } else {
    /* Return minimum double */
    /* For bigendian machines swap i[0] and i[1] */
    aa.i[0] = 0;
    aa.i[1] = 0x100000;
  }

  return aa.d;
}
main()
{
  double rmax, rmin, inf, zero;
  union a {
    double d;
    unsigned int i[2];
  } aa;

  rmax = rvals(0);
  rmin = rvals(1);

  inf = rmax / rmin;
  zero = 1.0 / inf;

  if (zero != 0.0) {
    printf("ERROR\n");
    aa.d = rmax;
    printf("rmax: i[0] = %x, i[1] = %x\n", aa.i[0], aa.i[1]);
    aa.d = rmin;
    printf("rmin: i[0] = %x, i[1] = %x\n", aa.i[0], aa.i[1]);
    aa.d = inf;
    printf("inf: i[0] = %x, i[1] = %x\n", aa.i[0], aa.i[1]);
    aa.d = zero;
    printf("zero: i[0] = %x, i[1] = %x\n", aa.i[0], aa.i[1]);
  } else {
    printf("This works.\n");
  }
}
-------------------

I've added this information to the PR.

Is the test case valid?

Janis


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