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]

[tuples] Fix typo in gs_seq_last


This fixes a typo that was keeping gs_add() from adding statements
correctly.

I've also added more checks in the testsuite to better catch
regressions.

All tests pass, now on to actual work...

	* gimple-ir.h (gs_seq_last): Return last statement.
	* testsuite/gcc.dg/gimple/compound_expr.c: Add checks.
	* testsuite/gcc.dg/gimple/gs_call.c: Same.
	* testsuite/gcc.dg/gimple/constructors.c: Same.
	* testsuite/gcc.dg/gimple/gs_assign.c: Same.

Index: gimple-ir.h
===================================================================
--- gimple-ir.h	(revision 126051)
+++ gimple-ir.h	(working copy)
@@ -54,7 +54,7 @@ gs_seq_first (gs_seq s)
 static inline gimple
 gs_seq_last (gs_seq s)
 {
-  return s->first;
+  return s->last;
 }
 
 static inline void
Index: testsuite/gcc.dg/gimple/compound_expr.c
===================================================================
--- testsuite/gcc.dg/gimple/compound_expr.c	(revision 126052)
+++ testsuite/gcc.dg/gimple/compound_expr.c	(working copy)
@@ -9,4 +9,5 @@ void foo()
     a = (b, c);
 }
 
+/* { dg-final { scan-tree-dump-times "gimpleir: c.0 = c" 1 "gimple"} } */
 /* { dg-final { scan-tree-dump-times "gimpleir: a = c" 1 "gimple"} } */
Index: testsuite/gcc.dg/gimple/gs_call.c
===================================================================
--- testsuite/gcc.dg/gimple/gs_call.c	(revision 126051)
+++ testsuite/gcc.dg/gimple/gs_call.c	(working copy)
@@ -9,3 +9,6 @@ void foo()
 {
     bar(), tool();
 }
+
+/* { dg-final { scan-tree-dump-times "gimpleir: bar \\(\\)" 1 "gimple"} } */
+/* { dg-final { scan-tree-dump-times "gimpleir: tool \\(\\)" 1 "gimple"} } */
Index: testsuite/gcc.dg/gimple/constructors.c
===================================================================
--- testsuite/gcc.dg/gimple/constructors.c	(revision 126051)
+++ testsuite/gcc.dg/gimple/constructors.c	(working copy)
@@ -9,3 +9,10 @@ void foo()
     int a[5] = { 1, 2, 3, 4, 5 };
     bar(a);
 }
+
+/* { dg-final { scan-tree-dump-times "gimpleir: a.0. = 1" 1 "gimple"} } */
+/* { dg-final { scan-tree-dump-times "gimpleir: a.1. = 2" 1 "gimple"} } */
+/* { dg-final { scan-tree-dump-times "gimpleir: a.2. = 3" 1 "gimple"} } */
+/* { dg-final { scan-tree-dump-times "gimpleir: a.3. = 4" 1 "gimple"} } */
+/* { dg-final { scan-tree-dump-times "gimpleir: a.4. = 5" 1 "gimple"} } */
+/* { dg-final { scan-tree-dump-times "gimpleir: bar \\(&a\\)" 1 "gimple"} } */
Index: testsuite/gcc.dg/gimple/gs_assign.c
===================================================================
--- testsuite/gcc.dg/gimple/gs_assign.c	(revision 126051)
+++ testsuite/gcc.dg/gimple/gs_assign.c	(working copy)
@@ -8,3 +8,5 @@ void foo()
 {
     a = b + c;
 }
+
+/* { dg-final { scan-tree-dump-times "gimpleir: a.2 = b.0 \\+ c.1" 1 "gimple"} } */


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