re PR c++/72809 (ICE on x86_64-linux-gnu (Segmentation fault, tree_check))
authorJakub Jelinek <jakub@redhat.com>
Tue, 9 Aug 2016 07:23:47 +0000 (09:23 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 9 Aug 2016 07:23:47 +0000 (09:23 +0200)
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
gcc/cp/rtti.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/eh/stdarg1.C [new file with mode: 0644]

index 1344443b2dc3441c17f54dba6a38c222e457291c..1f032c7b81e445fb699220956ba77a3131250f9d 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-09  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <jason@redhat.com>
 
        Implement C++17 constexpr lambda.
index 43d5f15fa3f8035fef9f684129c1fc758df4665a..75aeb0bb82c560f7a8bcaa71fcb3a205334cbddd 100644 (file)
@@ -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;
index c00824dfd911dd6e22b7891836cf2673543f7e6c..f560fe45433cdb69f4d6a4a184f0bab0b331e317 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/72809
+       * g++.dg/eh/stdarg1.C: New test.
+
 2016-08-08  Andi Kleen  <ak@linux.intel.com>
 
        * 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 (file)
index 0000000..d4d2cc4
--- /dev/null
@@ -0,0 +1,30 @@
+// PR c++/72809
+// { dg-do compile }
+
+#include <stdarg.h>
+
+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 ();
+}