This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix bootstrap with GCC 3.4 (and likely anything < 4.4 except 4.2.[0-3]) (PR bootstrap/84405)
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>,Jonathan Wakely <jwakely at redhat dot com>
- Cc: Martin Sebor <msebor at gmail dot com>,gcc-patches at gcc dot gnu dot org
- Date: Sat, 17 Feb 2018 19:58:46 +0100
- Subject: Re: [PATCH] Fix bootstrap with GCC 3.4 (and likely anything < 4.4 except 4.2.[0-3]) (PR bootstrap/84405)
- Authentication-results: sourceware.org; auth=none
- References: <20180216083843.GN5867@tucnak> <4526a261-adce-342f-73f0-faf3d600832d@gmail.com> <20180216180510.GZ5867@tucnak> <688397E6-7324-43D3-A225-E2F0081E0E1E@suse.de> <20180216204433.GD5867@tucnak>
On February 16, 2018 9:44:33 PM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>On Fri, Feb 16, 2018 at 09:25:30PM +0100, Richard Biener wrote:
>> But the broken compilers will overwrite the memset data with possibly
>uninitialized fields of a TARGET_EXPR.
>
>Perhaps for hash-table.h we could use:
>#ifndef BROKEN_VALUE_INITIALIZATION
> for ( ; size; ++entries, --size)
> *entries = value_type ();
>#else
> union U { char c[sizeof (value_type)]; value_type v; } u;
> memset (u.c, '\0', sizeof (u.c));
> value_type *p = ::new (static_cast<void*>(u.c)) value_type ();
> for ( ; size; ++entries, --size)
> *entries = *p;
> p->~value_type ();
>#endif
>or so, if it is valid C++, which could turn the hash-table.h case into
>the vec.h case.
I don't think a workaround for a non-conforming compiler has to be strictly conforming. And the more complicated we make this the bigger the chances we hit some other latent bug.
Richard.
> Jakub