This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Revert fix for PR46076, fix PR47281
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Jan 2011 13:37:28 +0100 (CET)
- Subject: [PATCH] Revert fix for PR46076, fix PR47281
The fix for 46076 violates the transitivity rule of the gimple
type system.
Reverted.
Richard.
2011-01-14 Richard Guenther <rguenther@suse.de>
PR middle-end/47281
Revert
2011-01-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46076
* tree-ssa.c (useless_type_conversion_p): Conversions from
unprototyped to empty argument list function types are useless.
* gcc.dg/torture/pr47281.c: New testcase.
* gcc.dg/tree-ssa/pr46076.c: XFAIL.
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c (revision 168778)
--- gcc/tree-ssa.c (working copy)
*************** useless_type_conversion_p (tree outer_ty
*** 1410,1420 ****
if (!prototype_p (outer_type))
return true;
- /* A conversion between unprototyped and empty argument list is ok. */
- if (TYPE_ARG_TYPES (outer_type) == void_list_node
- && !prototype_p (inner_type))
- return true;
-
/* If the unqualified argument types are compatible the conversion
is useless. */
if (TYPE_ARG_TYPES (outer_type) == TYPE_ARG_TYPES (inner_type))
--- 1410,1415 ----
Index: gcc/testsuite/gcc.dg/torture/pr47281.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr47281.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr47281.c (revision 0)
***************
*** 0 ****
--- 1,23 ----
+ /* { dg-do compile } */
+
+ struct T;
+ typedef void F(void);
+
+ F* aux(void (*x)())
+ {
+ return x;
+ }
+
+ void make_mess (int);
+
+ F*
+ get_funloc (void (*x)(int), F* (*y)())
+ {
+ return y(x);
+ }
+
+ F*
+ foo ()
+ {
+ return get_funloc (make_mess, aux);
+ }
Index: gcc/testsuite/gcc.dg/tree-ssa/pr46076.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/pr46076.c (revision 168778)
--- gcc/testsuite/gcc.dg/tree-ssa/pr46076.c (working copy)
***************
*** 1,7 ****
/* { dg-do link } */
/* { dg-options "-O2" } */
! extern void link_error (void);
typedef unsigned char(*Calculable)(void);
--- 1,7 ----
/* { dg-do link } */
/* { dg-options "-O2" } */
! extern void link_error (void) { /* XFAIL */ }
typedef unsigned char(*Calculable)(void);