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]

Re: gimple vs volatiles vs enumerations



On Sep 26, 2005, at 7:17 PM, David Edelsohn wrote:


* gimplify.c (create_tmp_from_val): Use TYPE_MAIN_VARIANT.

The gimplify.c part of the original patch causes a new testsuite
regression gcc.c-torture/execute/20000519-1.c

http://gcc.gnu.org/ml/gcc-regression/2005-09/msg00040.html

Specifically,

From the looking at the tree dumps, this looks very much a tree-stdargs.c bug. It is not tracking the use of variable correctly at all.

What we have in the dump:
  __builtin_va_start (&ap, 0, 0);
  ap.2_3 = ap;

  # ap_1 = PHI <ap.2_3(0), ap_8(1)>;
<L1>:;
  ap_8 = ap_1 + 4B;
  ap.1_9 = (int *) ap_1;
  b_10 = *ap.1_9;
  if (b_10 > 10) goto <L1>; else goto <L2>;

<L2>:;
  D.1287_11 = a_4 + b_10;
  return D.1287_11;


Notice how we change from ap.2_3 to ap_1 in the PHI. Here is a valid C testcase that fails even with RTH's patch reverted: #include <stdarg.h>

int
foo (int a, ...)
{
  va_list ap;
  va_list ap1;
  va_list ap2;
  va_list ap3;
  va_list ap4;

  va_start (ap, a);
  int b;
  ap1 = ap;
  ap2 = ap1;

  do {
   ap1 = ap2;
    b = va_arg (ap1, int);
    ap2 = ap1;
  } while (b > 10);

return a + b;

}

int
main ()
{
  if (foo (1, 2, 3) != 3)
    abort ();
  return 0;
}



-- Pinski


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