This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lno]: Patch: fix bootstrap heisenbug
Dale Johannesen <dalej@apple.com> writes:
> On Jun 16, 2004, at 1:52 PM, Geoffrey Keating wrote:
> > Dale Johannesen <dalej@apple.com> writes:
> >> This showed up as a not-easily-repeatable bootstrap failure on Darwin.
> >> The trees pointed to by chrec_top and chrec_bot were recreated for
> >> each
> >> function, and the variables were not cleared at the end of the
> >> function.
> >> As they used ggc memory but were not declared via GTY, they pointed to
> >> random values at the beginning of the second function, and if you were
> >> especially unlucky about what they were pointing at, the code that
> >> recreates
> >> them would do the wrong thing. This creates these variables only once
> >> per
> >> compilation, and makes them known to the GTY machinery. Bootstrapped
> >> and tested on Darwin. OK?
> >
> > The GTYing part of this patch is OK, but the Makefile changes need
> > some work.
> > What I would do is:
> >
> > - Have tree-chrec.h include tree-dg.h and tree-fold-const.h
> > - Put multiple-inclusion guards around tree-dg.h and tree-fold-const.h,
> > if necessary
> > - Create a new Makefile variable called $(TREE_CHREC_H) like all the _H
> > macros
> > - Add that into GTFILES and every other place where tree-chrec.h is
> > mentioned.
>
> OK, I can do this, but I've already committed the patch as approved by
> Zdenek, so
> this will have to be another patch. (There is no dependency on
> tree-dg.h, btw, that
> bit is fixing an unrelated merge bug.) This is what I'm testing:
This is OK if it passes testing.
>
> Index: Makefile.in
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
> retrieving revision 1.903.2.158.2.33
> diff -u -d -b -w -r1.903.2.158.2.33 Makefile.in
> --- Makefile.in 16 Jun 2004 20:54:52 -0000 1.903.2.158.2.33
> +++ Makefile.in 16 Jun 2004 21:04:36 -0000
> @@ -726,7 +726,8 @@
> PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H)
> DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
> C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
> -SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h
> tree-fold-const.h
> +TREE_CHREC_H = tree-chrec.h tree-fold-const.h
> +SCEV_H = tree-scalar-evolution.h $(GGC_H) $(TREE_CHREC_H)
>
> #
>
> # Now figure out from those variables how to compile and link.
> @@ -1724,7 +1725,7 @@
> tree-fold-const.o: tree-fold-const.c $(CONFIG_H) $(SYSTEM_H)
> coretypes.h \
> $(TM_H) errors.h $(GGC_H) $(TREE_H) tree-fold-const.h
> tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h
> $(TM_H) \
> - errors.h $(GGC_H) $(TREE_H) tree-chrec.h tree-fold-const.h
> tree-pass.h
> + errors.h $(GGC_H) $(TREE_H) $(TREE_CHREC_H) tree-pass.h
> tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H)
> $(SYSTEM_H) \
> coretypes.h $(TM_H) errors.h $(GGC_H) $(TREE_H) $(RTL_H) \
> $(BASIC_BLOCK_H) diagnostic.h $(TREE_FLOW_H) $(TREE_DUMP_H) \
> @@ -2390,7 +2391,7 @@
> $(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
> $(srcdir)/tree-alias-type.h $(srcdir)/tree-alias-common.h \
> $(srcdir)/tree-alias-type.c $(srcdir)/tree-alias-common.c \
> - $(srcdir)/tree-chrec.h \
> + $(TREE_CHREC_H) \
> $(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \
> $(srcdir)/tree-profile.c $(srcdir)/rtl-profile.c
> $(srcdir)/tree-nested.c \
> $(out_file) \
> Index: gengtype.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
> retrieving revision 1.7.4.24.2.7
> diff -u -d -b -w -r1.7.4.24.2.7 gengtype.c
> --- gengtype.c 16 Jun 2004 20:54:52 -0000 1.7.4.24.2.7
> +++ gengtype.c 16 Jun 2004 21:04:39 -0000
> @@ -1110,7 +1110,7 @@
> "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
> "tree-alias-type.h", "tree-flow.h", "reload.h",
> "tree-data-ref.h", "cpp-id-data.h", "tree-dg.h",
> - "tree-fold-const.h", "tree-chrec.h",
> + "tree-chrec.h",
> NULL
> };
> const char *const *ifp;
> Index: tree-chrec.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-chrec.h,v
> retrieving revision 1.1.2.22
> diff -u -d -b -w -r1.1.2.22 tree-chrec.h
> --- tree-chrec.h 16 Jun 2004 20:54:52 -0000 1.1.2.22
> +++ tree-chrec.h 16 Jun 2004 21:04:39 -0000
> @@ -22,6 +22,8 @@
> #ifndef GCC_TREE_CHREC_H
> #define GCC_TREE_CHREC_H
>
> +#include "tree-fold-const.h"
> +
> /* Accessors for the chains of recurrences. */
> #define CHREC_VAR(NODE) TREE_OPERAND (NODE, 0)
> #define CHREC_LEFT(NODE) TREE_OPERAND (NODE, 1)