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]

[PATCH, testsuit] Add tests for PR33009


Hi,

This patch adds some trivial checks for -frtl-abstract-sequences.
Inspired by PR33009.

Ok for trunk?

--Gabor


2007-03-03 Gabor Loki <loki@gcc.gnu.org>


	PR 33009
	* gcc.c-torture/compile/pr11832.c: Check -frtl-abstract-sequences.
	* gcc.c-torture/compile/pr33009.c: Likewise.


Index: gcc/testsuite/gcc.c-torture/compile/pr33009.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/pr33009.c	(revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/pr33009.c	(revision 0)
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-frtl-abstract-sequences" } */
+
+char *progName;
+int bar0 (char *, ...);
+void bar1 (char *);
+void exit (int);
+
+
+#define SAME \
+ bar0 ("%s: Bad flag `%s'\n", argv[i], argv[i] );\
+ bar1 ( progName ); \
+ exit ( 1 );
+
+
+int foo ( int argc, char *argv[] )
+{
+    int i;
+    for (i = 0; i < argc; i++) {
+	switch (argv[i][0]) {
+	case 'c':
+	    break;
+	default: 
+	
+	    SAME
+	    
+	    break;
+	}
+    }
+    for (i = 0; i < argc; i++) {
+    
+	SAME
+	
+    }
+    return 0;
+}
Index: gcc/testsuite/gcc.c-torture/compile/pr11832.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/pr11832.c	(revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/pr11832.c	(revision 0)
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-frtl-abstract-sequences" } */
+
+int a, b, e;
+unsigned char *c;
+void foo()
+{
+  int d = 13;
+  b = -1;   
+  switch (e) {
+    case 1:
+      b++; c[b] = (unsigned char)d;
+      break;
+    case 2:
+      b++; c[b] = (unsigned char)d;
+      b++; c[b] = (unsigned char)d;
+      break;
+    case 3:
+      b++; c[b] = (unsigned char)d;
+      b++; c[b] = (unsigned char)d;
+      b++; c[b] = (unsigned char)d;
+      break;
+    default:
+      a = 1;
+      b++; c[b] = (unsigned char)d;
+      b++; c[b] = (unsigned char)d;
+      b++; c[b] = (unsigned char)d;
+      b++; c[b] = (unsigned char)d;
+  }
+}



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