From cadec7ca6e41f459aa2e156e672e6941660f26db Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 9 Aug 2016 09:23:47 +0200 Subject: [PATCH] re PR c++/72809 (ICE on x86_64-linux-gnu (Segmentation fault, tree_check)) PR c++/72809 * rtti.c (get_pseudo_ti_index): Return TK_CLASS_TYPE for builtin aggregate types without TYPE_BINFO. * g++.dg/eh/stdarg1.C: New test. From-SVN: r239272 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/rtti.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/eh/stdarg1.C | 30 ++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/stdarg1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1344443b2dc..1f032c7b81e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-08-09 Jakub Jelinek + + PR c++/72809 + * rtti.c (get_pseudo_ti_index): Return TK_CLASS_TYPE for + builtin aggregate types without TYPE_BINFO. + 2016-08-08 Jason Merrill Implement C++17 constexpr lambda. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 43d5f15fa3f..75aeb0bb82c 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1293,7 +1293,8 @@ get_pseudo_ti_index (tree type) ix = TK_CLASS_TYPE; break; } - else if (!BINFO_N_BASE_BINFOS (TYPE_BINFO (type))) + else if (!TYPE_BINFO (type) + || !BINFO_N_BASE_BINFOS (TYPE_BINFO (type))) { ix = TK_CLASS_TYPE; break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c00824dfd91..f560fe45433 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-09 Jakub Jelinek + + PR c++/72809 + * g++.dg/eh/stdarg1.C: New test. + 2016-08-08 Andi Kleen * lib/profopt.exp: (auto-profopt-execute): Don't include full diff --git a/gcc/testsuite/g++.dg/eh/stdarg1.C b/gcc/testsuite/g++.dg/eh/stdarg1.C new file mode 100644 index 00000000000..d4d2cc4e359 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/stdarg1.C @@ -0,0 +1,30 @@ +// PR c++/72809 +// { dg-do compile } + +#include + +int +foo (int a, ...) +{ + va_list ap; + int r = 0; + va_start (ap, a); + try + { + if (a == 1) + throw (ap); + } + catch (va_list b) + { + r = va_arg (b, int); + } + va_end (ap); + return r; +} + +int +main () +{ + if (foo (0) != 0 || foo (1, 7) != 7) + __builtin_abort (); +} -- 2.30.2