diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-02-16 10:05:35 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-02-16 10:05:35 +0100 |
commit | ab67039ccd31de6d0192d4560ff971ff0af81726 (patch) | |
tree | 0263d95f48f4201cf663f022f24d2e4e85fd6d6d /gcc | |
parent | 33006d53fd3adf2baae85b625e3ec99908b7a31c (diff) | |
download | gcc-ab67039ccd31de6d0192d4560ff971ff0af81726.zip gcc-ab67039ccd31de6d0192d4560ff971ff0af81726.tar.gz gcc-ab67039ccd31de6d0192d4560ff971ff0af81726.tar.bz2 |
re PR bootstrap/84405 (Fails to bootstrap with GCC 4.1.2, GCC 4.2.4)
PR bootstrap/84405
* system.h (BROKEN_VALUE_INITIALIZATION): Define for GCC < 4.3.
* vec.h (vec_default_construct): Use memset instead of placement new
if BROKEN_VALUE_INITIALIZATION is defined.
* hash-table.h (hash_table<Descriptor, Allocator>::empty_slow): Use
memset instead of value initialization if BROKEN_VALUE_INITIALIZATION
is defined.
From-SVN: r257726
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/hash-table.h | 4 | ||||
-rw-r--r-- | gcc/system.h | 6 | ||||
-rw-r--r-- | gcc/vec.h | 4 |
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76eee8a..85c7880 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2018-02-16 Jakub Jelinek <jakub@redhat.com> + PR bootstrap/84405 + * system.h (BROKEN_VALUE_INITIALIZATION): Define for GCC < 4.3. + * vec.h (vec_default_construct): Use memset instead of placement new + if BROKEN_VALUE_INITIALIZATION is defined. + * hash-table.h (hash_table<Descriptor, Allocator>::empty_slow): Use + memset instead of value initialization if BROKEN_VALUE_INITIALIZATION + is defined. + PR rtl-optimization/83723 * lra-int.h (lra_substitute_pseudo): Add DEBUG_P argument. * lra.c (lra_substitute_pseudo): Likewise. If true, use diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 8e22cbb..706b237 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -804,8 +804,12 @@ hash_table<Descriptor, Allocator>::empty_slow () } else { +#ifndef BROKEN_VALUE_INITIALIZATION for ( ; size; ++entries, --size) *entries = value_type (); +#else + memset (entries, 0, size * sizeof (value_type)); +#endif } m_n_deleted = 0; m_n_elements = 0; diff --git a/gcc/system.h b/gcc/system.h index 5d9aaae..4abc321 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -824,6 +824,12 @@ extern void fancy_abort (const char *, int, const char *) /* Some compilers do not allow the use of unsigned char in bitfields. */ #define BOOL_BITFIELD unsigned int +/* GCC older than 4.4 have broken C++ value initialization handling, see + PR11309, PR30111, PR33916, PR82939 and PR84405 for more details. */ +#if GCC_VERSION > 0 && GCC_VERSION < 4004 && !defined(__clang__) +# define BROKEN_VALUE_INITIALIZATION +#endif + /* As the last action in this file, we poison the identifiers that shouldn't be used. Note, luckily gcc-3.0's token-based integrated preprocessor won't trip on poisoned identifiers that arrive from @@ -490,8 +490,12 @@ template <typename T> inline void vec_default_construct (T *dst, unsigned n) { +#ifndef BROKEN_VALUE_INITIALIZATION for ( ; n; ++dst, --n) ::new (static_cast<void*>(dst)) T (); +#else + memset (dst, '\0', sizeof (T) * n); +#endif } /* Copy-construct N elements in DST from *SRC. */ |