diff mbox

[PR,43665] Make IPA-CP punt when type attributes are present

Message ID 20100907151457.GD30878@virgil.arch.suse.de
State New
Headers show

Commit Message

Martin Jambor Sept. 7, 2010, 3:14 p.m. UTC
Hi,

this small patch prevents IPA-CP from modifying functions that have
type attributes because if these describe parameters, they get out of
sync after IPA-CP removes those that are constant or unnecessary.
IPA-SRA already does exactly the same thing.  AFAIK, the patch allows
the main fix of PR 43665 to be committed without causing regressions.

The proper solutions would be to update the attributes but I believe
this should be done only after we unify parameter manipulation, until
then this a quick fix preventing miscompilations.

The patch has no testcase because after the patch for the actual PR
gets in, gfortran.dg/allocatable_scalar_4.f90 will become one.

Bootstrapped and tested on x86_64-linux without any regressions, OK
for trunk?

Thanks,

Martin


2010-09-07  Martin Jambor  <mjambor@suse.cz>

	PR fortran/43665
	* ipa-cp.c (ipcp_versionable_function_p): Return false if there
	are any type attributes.

Comments

Richard Biener Sept. 7, 2010, 3:43 p.m. UTC | #1
On Tue, 7 Sep 2010, Martin Jambor wrote:

> Hi,
> 
> this small patch prevents IPA-CP from modifying functions that have
> type attributes because if these describe parameters, they get out of
> sync after IPA-CP removes those that are constant or unnecessary.
> IPA-SRA already does exactly the same thing.  AFAIK, the patch allows
> the main fix of PR 43665 to be committed without causing regressions.
> 
> The proper solutions would be to update the attributes but I believe
> this should be done only after we unify parameter manipulation, until
> then this a quick fix preventing miscompilations.
> 
> The patch has no testcase because after the patch for the actual PR
> gets in, gfortran.dg/allocatable_scalar_4.f90 will become one.
> 
> Bootstrapped and tested on x86_64-linux without any regressions, OK
> for trunk?

Ok.

Thanks,
Richard.

> Thanks,
> 
> Martin
> 
> 
> 2010-09-07  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR fortran/43665
> 	* ipa-cp.c (ipcp_versionable_function_p): Return false if there
> 	are any type attributes.
> 
> Index: icln/gcc/ipa-cp.c
> ===================================================================
> --- icln.orig/gcc/ipa-cp.c
> +++ icln/gcc/ipa-cp.c
> @@ -427,8 +427,11 @@ ipcp_versionable_function_p (struct cgra
>  {
>    struct cgraph_edge *edge;
>  
> -  /* There are a number of generic reasons functions cannot be versioned.  */
> -  if (!node->local.versionable)
> +  /* There are a number of generic reasons functions cannot be versioned.  We
> +     also cannot remove parameters if there are type attributes such as fnspec
> +     present.  */
> +  if (!node->local.versionable
> +      || TYPE_ATTRIBUTES (TREE_TYPE (node->decl)))
>      return false;
>  
>    /* Removing arguments doesn't work if the function takes varargs
> 
>
diff mbox

Patch

Index: icln/gcc/ipa-cp.c
===================================================================
--- icln.orig/gcc/ipa-cp.c
+++ icln/gcc/ipa-cp.c
@@ -427,8 +427,11 @@  ipcp_versionable_function_p (struct cgra
 {
   struct cgraph_edge *edge;
 
-  /* There are a number of generic reasons functions cannot be versioned.  */
-  if (!node->local.versionable)
+  /* There are a number of generic reasons functions cannot be versioned.  We
+     also cannot remove parameters if there are type attributes such as fnspec
+     present.  */
+  if (!node->local.versionable
+      || TYPE_ATTRIBUTES (TREE_TYPE (node->decl)))
     return false;
 
   /* Removing arguments doesn't work if the function takes varargs