diff mbox

Fix streaming of target optimization/option nodes

Message ID 20141215215618.GB6931@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Dec. 15, 2014, 9:56 p.m. UTC
> On Mon, 15 Dec 2014, Jan Hubicka wrote:
> 
> > Hi, actually this patch break fortran, I get streaming error in: lto1: 
> > internal compiler error: in streamer_get_pickled_tree apparently picking 
> > error_mark_node for variable constructor results in reading 
> > integer_type...
> 
> ?
> 
> Probably the default nodes are referenced by another builtin tree instead
> and you get inconsistent streaming between f951 and lto1.  See the
> assert placed into record_common_node which you should extend to cover
> the optimization node trees.

It seems that whole common node preloading is a major can of worms ;(. Anyway
the problem here is that record_common_node replaces every NULL by error_mark_node.
It thus matters what is the last NULL pointer recorded.  It used to be TI_CURRENT_OPTIMIZE_PRAGMA
but now it is TI_PID_TYPE in some cases, TI_MAIN_IDENTIFIER in others and
real error_mark_node in rest of cases.

I am testing the following.
Honza

Comments

Richard Biener Dec. 16, 2014, 9:26 a.m. UTC | #1
On Mon, 15 Dec 2014, Jan Hubicka wrote:

> > On Mon, 15 Dec 2014, Jan Hubicka wrote:
> > 
> > > Hi, actually this patch break fortran, I get streaming error in: lto1: 
> > > internal compiler error: in streamer_get_pickled_tree apparently picking 
> > > error_mark_node for variable constructor results in reading 
> > > integer_type...
> > 
> > ?
> > 
> > Probably the default nodes are referenced by another builtin tree instead
> > and you get inconsistent streaming between f951 and lto1.  See the
> > assert placed into record_common_node which you should extend to cover
> > the optimization node trees.
> 
> It seems that whole common node preloading is a major can of worms ;(

It is.  I've tried to get rid of most of it but unfortunately those
pointer-compares to builtin trees remain (at least va_list node).
It was also before SCC tree merging so maybe the situation isn't as bad
as it was (and we reliably at least merge cross-TU builtins where
necessary).

Ideally we'd be down to an explicitely list of pre-loaded nodes,
abstracted into a predicate function so we can update the assert
from a single place as well.  But I'm quite sure it's nothing for
stage3 ;)

Btw - please update the assert (or even better do that predicate 
function).

Thanks,
Richard.

>. Anyway
> the problem here is that record_common_node replaces every NULL by error_mark_node.
> It thus matters what is the last NULL pointer recorded.  It used to be TI_CURRENT_OPTIMIZE_PRAGMA
> but now it is TI_PID_TYPE in some cases, TI_MAIN_IDENTIFIER in others and
> real error_mark_node in rest of cases.
> 
> I am testing the following.
> Honza
> 
> Index: tree-streamer.c
> ===================================================================
> --- tree-streamer.c	(revision 218726)
> +++ tree-streamer.c	(working copy)
> @@ -324,7 +324,18 @@ preload_common_nodes (struct streamer_tr
>      /* Skip boolean type and constants, they are frontend dependent.  */
>      if (i != TI_BOOLEAN_TYPE
>  	&& i != TI_BOOLEAN_FALSE
> -	&& i != TI_BOOLEAN_TRUE)
> +	&& i != TI_BOOLEAN_TRUE
> +	/* MAIN_IDENTIFIER is not always initialized by Fortran FE.  */
> +	&& i != TI_MAIN_IDENTIFIER
> +	/* PID_TYPE is initialized only by C family front-ends.  */
> +	&& i != TI_PID_TYPE
> +	/* Skip optimization and target option nodes; they depend on flags.  */
> +	&& i != TI_OPTIMIZATION_DEFAULT
> +	&& i != TI_OPTIMIZATION_CURRENT
> +	&& i != TI_TARGET_OPTION_DEFAULT
> +	&& i != TI_TARGET_OPTION_CURRENT
> +	&& i != TI_CURRENT_TARGET_PRAGMA
> +	&& i != TI_CURRENT_OPTIMIZE_PRAGMA)
>        record_common_node (cache, global_trees[i]);
>  }
>  
> 
>
diff mbox

Patch

Index: tree-streamer.c
===================================================================
--- tree-streamer.c	(revision 218726)
+++ tree-streamer.c	(working copy)
@@ -324,7 +324,18 @@  preload_common_nodes (struct streamer_tr
     /* Skip boolean type and constants, they are frontend dependent.  */
     if (i != TI_BOOLEAN_TYPE
 	&& i != TI_BOOLEAN_FALSE
-	&& i != TI_BOOLEAN_TRUE)
+	&& i != TI_BOOLEAN_TRUE
+	/* MAIN_IDENTIFIER is not always initialized by Fortran FE.  */
+	&& i != TI_MAIN_IDENTIFIER
+	/* PID_TYPE is initialized only by C family front-ends.  */
+	&& i != TI_PID_TYPE
+	/* Skip optimization and target option nodes; they depend on flags.  */
+	&& i != TI_OPTIMIZATION_DEFAULT
+	&& i != TI_OPTIMIZATION_CURRENT
+	&& i != TI_TARGET_OPTION_DEFAULT
+	&& i != TI_TARGET_OPTION_CURRENT
+	&& i != TI_CURRENT_TARGET_PRAGMA
+	&& i != TI_CURRENT_OPTIMIZE_PRAGMA)
       record_common_node (cache, global_trees[i]);
 }