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]

fix g++.dg/ext/stmtexpr2.C


Given "A(10) + A(11)", it is legal for the compiler to chose
either A(10) or A(11) to be created first, which selects from
two possible sequences of constructions and destructions.

For whatever reason, i686 is choosing alternative 1, and alpha
is choosing alternative 2.  So this removes a FAIL for alpha.


r~


        * g++.dg/ext/stmtexpr2.C (alt1): Rename from expected.
        (alt2, which): New.
        (Check): Accept either alternative.

Index: g++.dg/ext/stmtexpr2.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/ext/stmtexpr2.C,v
retrieving revision 1.1
diff -c -p -d -r1.1 stmtexpr2.C
*** g++.dg/ext/stmtexpr2.C	18 Jun 2004 03:05:15 -0000	1.1
--- g++.dg/ext/stmtexpr2.C	29 Jul 2004 18:34:19 -0000
***************
*** 4,22 ****
  extern "C" int printf (char const *, ...);
  extern "C" void abort ();
  
! static unsigned int expected[] = {
!   11, 10, 21, 110, 111, 121
! };
  static unsigned int pointer = 0;
  
  static void Check (unsigned t, unsigned i, void const *ptr, char const *name)
  {
    printf ("%d %d %p %s\n", t, i, ptr, name);
  
!   if (pointer > sizeof(expected)/sizeof(expected[0]))
      abort ();
!   if (t + i != expected[pointer++])
      abort ();
  }
  
  struct A 
--- 4,34 ----
  extern "C" int printf (char const *, ...);
  extern "C" void abort ();
  
! // There are two alternate legal renderings.
! static unsigned int alt1[] = { 11, 10, 21, 110, 111, 121 };
! static unsigned int alt2[] = { 10, 11, 21, 111, 110, 121 };
! 
  static unsigned int pointer = 0;
+ static unsigned int *which;
  
  static void Check (unsigned t, unsigned i, void const *ptr, char const *name)
  {
    printf ("%d %d %p %s\n", t, i, ptr, name);
  
!   if (pointer > sizeof(alt1)/sizeof(alt1[0]))
      abort ();
!   if (pointer == 0)
!     {
!       if (t + i == alt1[0])
! 	which = &alt1[0];
!       else if (t + i == alt2[0])
! 	which = &alt2[0];
!       else
! 	abort ();
!     }
!   else if (t + i != which[pointer])
      abort ();
+   pointer++;
  }
  
  struct A 


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