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

[3.4 testcase] PR 18084 fixed by PR 17581


Whilst looking looking through wrong-code regressions in 3.4, I
discovered that PR rtl-optimization/18084 was caused by the same
REG_RETVAL issue that I fixed for PR rtl-optimization/17581, and
indeed this morning's commit to the 3.4 branch cures the failure.
Must be my lucky day :>

The following testcase for PR 18084 should prevent it coming back
in future.  This test has been checked on i686-pc-linux gnu with
a "make check-g++" on both the mainline and gcc-3_4-branch.  I've
committed it to mainline as obvious, but the 3.4 branch is currently
frozen.

Ok for the gcc-3_4-branch?


2004-10-30  Roger Sayle  <roger@eyesopen.com>

	PR rtl-optimization/18084
	* g++.dg/opt/pr18084-1.C: New testcase.


// { dg-do run }
// { dg-options "-O3" }

extern "C" void abort (void);

struct X {
    bool init;
    void foo() { if (!init) init = true; }
    void bar() { foo();                  }

};

typedef unsigned long long int uint64_t;
uint64_t mask1, mask2;

uint64_t calc() {
  return mask1 & mask2;
}

int main()
{
  mask1 = 0x00000000FFFFFFFFull;
  mask2 = 0x000000000000FFFFull;
  uint64_t value = calc();

  X().bar();

  if(value != calc())
    abort ();
  return 0;
}


Roger
--


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