This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lno]: Patch: fix bootstrap heisenbug
- From: Geoffrey Keating <geoffk at geoffk dot org>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 16 Jun 2004 13:52:35 -0700
- Subject: Re: [lno]: Patch: fix bootstrap heisenbug
- References: <34D285E4-BFCB-11D8-B9BA-000A95D7CD40@apple.com>
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.
> 2004-06-16 Dale Johannesen <dalej@apple.com>
> * Makefile.in (GTFILES): Add tree-chrec.h.
> * tree-chrec.h (chrec_top, chrec_bot): Add GTY.
> * tree-scalar-evolution.c
> (initialize_scalar_evolutions_analyzer):
> Set chrec_top, chrec_bot once per compilation.
> * gengtype.c (ifiles): Add tree-fold-const.h, tree-chrec.h.
>
> (Note - tree-fold-const.h in gengtype.c is needed for tree-chrec.h to
> compile;
> tree-dg.h was added 2/16 by Devang and apparently dropped in the last
> merge.)
>
> Index: tree-chrec.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-chrec.h,v
> retrieving revision 1.1.2.21
> diff -u -d -b -w -r1.1.2.21 tree-chrec.h
> --- tree-chrec.h 10 Jun 2004 06:57:04 -0000 1.1.2.21
> +++ tree-chrec.h 16 Jun 2004 19:04:41 -0000
> @@ -37,8 +37,8 @@
> and not on their value. */
>
> extern tree chrec_not_analyzed_yet;
> -extern tree chrec_top;
> -extern tree chrec_bot;
> +extern GTY(()) tree chrec_top;
> +extern GTY(()) tree chrec_bot;
>
> /* After having added an automatically generated element, please
> include it in the following function. */
> Index: tree-scalar-evolution.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-scalar-evolution.c,v
> retrieving revision 1.1.2.56
> diff -u -d -b -w -r1.1.2.56 tree-scalar-evolution.c
> --- tree-scalar-evolution.c 11 Jun 2004 02:51:27 -0000 1.1.2.56
> +++ tree-scalar-evolution.c 16 Jun 2004 19:04:41 -0000
> @@ -2850,12 +2850,15 @@
> {
> /* The elements below are unique. The values contained in these
> intervals are not used. */
> + if (chrec_top == NULL_TREE)
> + {
> chrec_not_analyzed_yet = NULL_TREE;
> chrec_top = build_interval_chrec
> (build_int_2 (2222, 0), build_int_2 (3222, 0));
> chrec_bot = build_interval_chrec
> (build_int_2 (3333, 0), build_int_2 (4333, 0));
> }
> +}
>
> /* Initialize the analysis of scalar evolutions for LOOPS. */
>
> Index: gengtype.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
> retrieving revision 1.7.4.24.2.6
> diff -u -d -b -w -r1.7.4.24.2.6 gengtype.c
> --- gengtype.c 14 Jun 2004 01:58:04 -0000 1.7.4.24.2.6
> +++ gengtype.c 16 Jun 2004 19:04:41 -0000
> @@ -1109,7 +1109,8 @@
> "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h",
> "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-data-ref.h", "cpp-id-data.h", "tree-dg.h",
> + "tree-fold-const.h", "tree-chrec.h",
> NULL
> };
> const char *const *ifp;
> Index: Makefile.in
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
> retrieving revision 1.903.2.158.2.31
> diff -u -d -b -w -r1.903.2.158.2.31 Makefile.in
> --- Makefile.in 14 Jun 2004 01:57:34 -0000 1.903.2.158.2.31
> +++ Makefile.in 16 Jun 2004 19:04:41 -0000
> @@ -2394,6 +2394,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 \
> $(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \
> $(srcdir)/tree-profile.c $(srcdir)/rtl-profile.c
> $(srcdir)/tree-nested.c \
> $(out_file) \