This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: change initialization of ptrdiff_type_node
- From: Richard Biener <rguenther at suse dot de>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Nov 2016 12:48:37 +0100 (CET)
- Subject: Re: change initialization of ptrdiff_type_node
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMkp2_qq5Ton3KVAQMPFqTKmZVjMrO365Ki3JX=0qhMcMQ@mail.gmail.com> <20161125080511.GG3541@tucnak.redhat.com> <alpine.LSU.2.11.1611250909080.5294@t29.fhfr.qr> <CAAgBjM=uUTFhCK5w4KXq3uaRVB4oA+8fWAvgbYuRY+c0RKpi6Q@mail.gmail.com> <alpine.LSU.2.11.1611251017460.5294@t29.fhfr.qr> <CAAgBjMm6zngO=PwR4P7-J-0dohXHgUs5tOeWzJRHQXtX8F5dHg@mail.gmail.com>
On Sat, 26 Nov 2016, Prathamesh Kulkarni wrote:
> On 25 November 2016 at 14:48, Richard Biener <rguenther@suse.de> wrote:
> > On Fri, 25 Nov 2016, Prathamesh Kulkarni wrote:
> >
> >> On 25 November 2016 at 13:43, Richard Biener <rguenther@suse.de> wrote:
> >> > On Fri, 25 Nov 2016, Jakub Jelinek wrote:
> >> >
> >> >> On Fri, Nov 25, 2016 at 01:28:06PM +0530, Prathamesh Kulkarni wrote:
> >> >> > --- a/gcc/lto/lto-lang.c
> >> >> > +++ b/gcc/lto/lto-lang.c
> >> >> > @@ -1271,8 +1271,30 @@ lto_init (void)
> >> >> > gcc_assert (TYPE_MAIN_VARIANT (const_tm_ptr_type_node)
> >> >> > == const_ptr_type_node);
> >> >> >
> >> >> > - ptrdiff_type_node = integer_type_node;
> >> >> > + if (strcmp (PTRDIFF_TYPE, "int") == 0)
> >> >> > + ptrdiff_type_node = integer_type_node;
> >> >> > + else if (strcmp (PTRDIFF_TYPE, "long int") == 0)
> >> >> > + ptrdiff_type_node = long_integer_type_node;
> >> >> > + else if (strcmp (PTRDIFF_TYPE, "long long int") == 0)
> >> >> > + ptrdiff_type_node = long_long_integer_type_node;
> >> >> > + else if (strcmp (PTRDIFF_TYPE, "short int") == 0)
> >> >> > + ptrdiff_type_node = short_integer_type_node;
> >> >> > + else
> >> >> > + {
> >> >> > + ptrdiff_type_node = NULL_TREE;
> >> >> > + for (int i = 0; i < NUM_INT_N_ENTS; i++)
> >> >> > + if (int_n_enabled_p[i])
> >> >> > + {
> >> >> > + char name[50];
> >> >> > + sprintf (name, "__int%d", int_n_data[i].bitsize);
> >> >> > + if (strcmp (name, PTRDIFF_TYPE) == 0)
> >> >> > + ptrdiff_type_node = int_n_trees[i].signed_type;
> >> >> > + }
> >> >> > + if (ptrdiff_type_node == NULL_TREE)
> >> >> > + gcc_unreachable ();
> >> >> > + }
> >> >>
> >> >> This looks ok to me.
> >> >
> >> > But I'd like to see this in build_common_tree_nodes alongside
> >> > the initialization of size_type_node (and thus removed from
> >> > c_common_nodes_and_builtins). This way you can simply remove
> >> > the lto-lang.c code as well.
> >> >
> >> > Please then also remove the ptrdiff_type_node re-set from
> >> > free_lang_data ().
> >> Hi Richard,
> >> Does this version look OK ?
> >> Validation in progress.
> >
> > Yes, patch is ok if testing succeeds.
> Thanks, the patch passes bootstrap+test on x86_64-unknown-linux-gnu
> with --enable-languages=all,ada
> and cross-tested on arm*-*-*, aarch64*-*-* with
> --enable-languages=c,c++,fortran.
>
> However LTO bootstrap fails with miscompares (attached)
> configured with: --disable-werror --enable-stage1-checking=release
> --with-build-config=bootstrap-lto
> I verified that the same miscompares happen without the patch too, and
> have committed it as r242888.
LTO bootstrap works fine for me (with checking enabled).
Richard.