[PATCH] Fix allocation of reg_known_value

Uros Bizjak ubizjak@gmail.com
Thu Nov 29 22:51:00 GMT 2012


Hello!

> When changing reg_known_value to a VEC, Steven sneaked in a small
> semantic change.  That change has the advantage of improving compilation
> time substantially on some testcases (including PR55489), but it is a
> bit heavy-handed: it also makes set_known_reg_value a no-op, while
> get_known_reg_value will always return NULL.
>
> This patch fixes the VEC usage.  Bootstrap/regtest in progress, but I'm
> going to commit this as obvious as soon as bootstrapping finishes.
>
> 2012-11-26  Paolo Bonzini  <pbonzini@redhat.com>
>
> 	* alias.c (init_alias_analysis): Fix allocation of reg_known_value.
>
> Index: ../../gcc/alias.c
> ===================================================================
> --- ../../gcc/alias.c	(revisione 193853)
> +++ ../../gcc/alias.c	(copia locale)
> @@ -2808,7 +2808,7 @@ init_alias_analysis (void)
>
>    timevar_push (TV_ALIAS_ANALYSIS);
>
> -  vec_alloc (reg_known_value, maxreg - FIRST_PSEUDO_REGISTER);
> +  vec_safe_grow_cleared (reg_known_value, maxreg - FIRST_PSEUDO_REGISTER);
>    reg_known_equiv_p = sbitmap_alloc (maxreg - FIRST_PSEUDO_REGISTER);
>
>    /* If we have memory allocated from the previous run, use it.  */

This one-liner causes following runtime test failure [1] for
alphaev68-linux-gnu:

FAIL: gfortran.fortran-torture/execute/save_1.f90 execution,  -O2
FAIL: gfortran.fortran-torture/execute/save_1.f90 execution,  -O2
-fomit-frame-pointer -finline-functions
FAIL: gfortran.fortran-torture/execute/save_1.f90 execution,  -O2
-fomit-frame-pointer -finline-functions -funroll-loops
FAIL: gfortran.fortran-torture/execute/save_1.f90 execution,  -O2
-fbounds-check

The patch miscompiles libgfortran library.

I will provide more info tomorrow, any hint what/where should I look
for differences?

[1] http://gcc.gnu.org/ml/gcc-testresults/2012-11/msg02492.html

Uros.



More information about the Gcc-patches mailing list