[PATCH] Remove broken testcase gcc.c-torture/execute/20020619-1.c

Richard Guenther rguenther@suse.de
Thu May 29 11:50:00 GMT 2008


Maybe I'm missing something obvious, but the testcase
gcc.c-torture/execute/20020619-1.c invokes undefined behavior in
test(), as *(int *)c references c through an incompatible lvalue.

In particular 6.5/7 doesn't make the object type special, but only
the lvalue type.  And the effective type of c is char (its declared
type).  And clearly char and int are not compatible either.

But well...  ok for mainline?  (this is the single testcase that
"breaks" if we fix PR36345, the TBAA-pruning of points-to sets)

Thanks,
Richard.


2008-05-29  Richard Guenther  <rguenther@suse.de>

	* gcc.c-torture/execute/20020619-1.c: Remove.

Index: testsuite/gcc.c-torture/execute/20020619-1.c
===================================================================
--- testsuite/gcc.c-torture/execute/20020619-1.c	(revision 136151)
+++ testsuite/gcc.c-torture/execute/20020619-1.c	(working copy)
@@ -1,32 +0,0 @@
-static int ref(void)
-{
-  union {
-    char c[5];
-    int i;
-  } u;
-
-  __builtin_memset (&u, 0, sizeof(u));
-  u.c[0] = 1;
-  u.c[1] = 2;
-  u.c[2] = 3;
-  u.c[3] = 4;
-
-  return u.i;
-}
-
-#define MAX(a,b)  (a < b ? b : a)
-
-static int test(void)
-{
-  char c[MAX(5, sizeof(int))] __attribute__((aligned)) = { 1, 2, 3, 4 };
-  return *(int *)c;
-}
-
-int main()
-{
-  int a = test();
-  int b = ref();
-  if (a != b)
-    abort ();
-  return 0;
-}



More information about the Gcc-patches mailing list