diff options
author | Gustavo Romero <gromero@linux.ibm.com> | 2020-04-15 15:14:45 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-04-15 15:14:45 +0200 |
commit | c00568f376078129196740d83946d54dc5437401 (patch) | |
tree | 9db39f1ab7db4c770ab338ccc8548d9a2f07149e /gcc | |
parent | 8a4436d89bfa0f731a48bf28d521f4b1b91014d7 (diff) | |
download | gcc-c00568f376078129196740d83946d54dc5437401.zip gcc-c00568f376078129196740d83946d54dc5437401.tar.gz gcc-c00568f376078129196740d83946d54dc5437401.tar.bz2 |
selftest: Work around GCC 4.2 PR33916 bug by optimizing the ctor [PR89494]
GCC 4.2 due to PR33916 miscompiles temp_dump_context ctor, because it doesn't
zero initialize the whole dump_context temporary on which it runs the static
get method and during destruction of the temporary an uninitialized pointer
is deleted.
More recent GCC versions properly zero initialize it and ideally optimize away
the construction/destruction of the temporary, as it isn't used for anything,
but there is no reason to create the temporary, static member functions can
be called without an associated object.
2020-04-15 Gustavo Romero <gromero@linux.ibm.com>
PR bootstrap/89494
* dumpfile.c (selftest::temp_dump_context::temp_dump_context):
Don't construct a dump_context temporary to call static method.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/dumpfile.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55f2e96..6148a82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-15 Gustavo Romero <gromero@linux.ibm.com> + + PR bootstrap/89494 + * dumpfile.c (selftest::temp_dump_context::temp_dump_context): + Don't construct a dump_context temporary to call static method. + 2020-04-15 Andrea Corallo <andrea.corallo@arm.com> * config/aarch64/falkor-tag-collision-avoidance.c diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 468ffab..e392ecf 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -2076,7 +2076,7 @@ temp_dump_context::temp_dump_context (bool forcibly_enable_optinfo, bool forcibly_enable_dumping, dump_flags_t test_pp_flags) : m_context (), - m_saved (&dump_context ().get ()) + m_saved (&dump_context::get ()) { dump_context::s_current = &m_context; if (forcibly_enable_optinfo) |