aboutsummaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-02-16 10:05:35 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-02-16 10:05:35 +0100
commitab67039ccd31de6d0192d4560ff971ff0af81726 (patch)
tree0263d95f48f4201cf663f022f24d2e4e85fd6d6d /gcc/vec.h
parent33006d53fd3adf2baae85b625e3ec99908b7a31c (diff)
downloadgcc-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/vec.h')
-rw-r--r--gcc/vec.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index 24f57b1..c707bcc 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -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. */