From: Marek Polacek Date: Mon, 12 Dec 2016 13:57:32 +0000 (+0000) Subject: re PR middle-end/78716 (ICE in gimplify_va_arg_expr, at gimplify.c:12650 (i686-linux... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3071bfa9c33aaad54db7ae1e87f0b5e26f095022;p=gcc.git re PR middle-end/78716 (ICE in gimplify_va_arg_expr, at gimplify.c:12650 (i686-linux-gnu)) PR middle-end/78716 * gimplify.c (gimplify_va_arg_expr): Don't require ADDR_EXPR for Case 1; check POINTER_TYPE_P instead. * g++.dg/other/vararg-5.C: New. From-SVN: r243553 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1dc690f42cb..81b0a3b48e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-12-12 Marek Polacek + + PR middle-end/78716 + * gimplify.c (gimplify_va_arg_expr): Don't require ADDR_EXPR for + Case 1; check POINTER_TYPE_P instead. + 2016-12-12 Bernd Schmidt PR rtl-optimization/78669 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8611060aea6..b738855a637 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -12643,7 +12643,7 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, return GS_ERROR; have_va_type = targetm.canonical_va_list_type (have_va_type); if (have_va_type == NULL_TREE - && TREE_CODE (valist) == ADDR_EXPR) + && POINTER_TYPE_P (TREE_TYPE (valist))) /* Handle 'Case 1: Not an array type' from c-common.c/build_va_arg. */ have_va_type = targetm.canonical_va_list_type (TREE_TYPE (TREE_TYPE (valist))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 66407ff05d9..588c51bd140 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-12 Marek Polacek + + PR middle-end/78716 + * g++.dg/other/vararg-5.C: New. + 2016-12-12 Bernd Schmidt PR rtl-optimization/78669 diff --git a/gcc/testsuite/g++.dg/other/vararg-5.C b/gcc/testsuite/g++.dg/other/vararg-5.C new file mode 100644 index 00000000000..9327bd6570f --- /dev/null +++ b/gcc/testsuite/g++.dg/other/vararg-5.C @@ -0,0 +1,24 @@ +// PR middle-end/78716 +// { dg-do compile } + +template + struct a; + template struct b; + template class e : b::c { + public: + typedef e f; + typedef typename b::c g; + e(__builtin_va_list *s) : g(__builtin_va_arg(*s, int)) {} + }; +template <> struct b { typedef e<> c; }; +template <> struct e<> { template e(h); }; +template class a : public e {}; +template +class a : e::f> { + public: + template + a(a) : a::f(0) {} +}; +template a<> r(i, j, k, l); +void q() { a(r(4, 6, 9, 7)); }