This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch ada]: Fix bootstrap for Ada
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Arnaud Charlet <charlet at adacore dot com>
- Cc: Kai Tietz <ktietz70 at googlemail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 24 May 2011 11:31:20 +0200
- Subject: Re: [patch ada]: Fix bootstrap for Ada
- References: <BANLkTikZ9dd_DXPN+=vPE6o-ATnpF_wJ0Q@mail.gmail.com> <20110524092520.GA7908@adacore.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, May 24, 2011 at 11:25:20AM +0200, Arnaud Charlet wrote:
> > this patch fixes an obvious bootstrap issue caused by trying to assign
> > a constant pointer to an none-constant.
> >
> > --- adaint.c (revision 174060)
> > +++ adaint.c (working copy)
> > @@ -3367,8 +3367,8 @@
> > char *
> > __gnat_to_canonical_file_list_next (void)
> > {
> > - static char *empty = "";
> > - return empty;
> > + static char empty[1];
> > + return &empty[0];
> > }
>
> I'm confused. The above looks wrong to me: it does not return an empty string,
> it returns a pointer to an uninitialized string, which cannot be right (and
> should generate a warning :-)
No, static vars are implicitly zero initialized when not explicitly
initialized.
Jakub