From: Jakub Jelinek Date: Tue, 19 Jul 2016 09:26:30 +0000 (+0200) Subject: backport: re PR c++/71871 (ICE on mixing templates and vector extensions ternary... X-Git-Tag: releases/gcc-4.9.4~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d471bc26f822b0a3fda069a73ead229bfa550ac4;p=thirdparty%2Fgcc.git backport: re PR c++/71871 (ICE on mixing templates and vector extensions ternary operator) Backported from mainline 2016-07-18 Jakub Jelinek PR c++/71871 * typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change. * g++.dg/ext/vector31.C: New test. From-SVN: r238465 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c3da35e71da1..dd8c0005dba1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-07-19 Jakub Jelinek + + Backported from mainline + 2016-07-18 Jakub Jelinek + + PR c++/71871 + * typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change. + 2016-07-07 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b3d3dfc77eda..6ed91251c96e 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6055,8 +6055,7 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2, } expr = build_conditional_expr (loc, ifexp, op1, op2, complain); - if (processing_template_decl && expr != error_mark_node - && TREE_CODE (expr) != VEC_COND_EXPR) + if (processing_template_decl && expr != error_mark_node) { tree min = build_min_non_dep (COND_EXPR, expr, orig_ifexp, orig_op1, orig_op2); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d61db44e0a71..82425bb3982d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2016-07-19 Jakub Jelinek Backported from mainline + 2016-07-18 Jakub Jelinek + + PR c++/71871 + * g++.dg/ext/vector31.C: New test. + 2016-07-11 Jakub Jelinek PR middle-end/71758 diff --git a/gcc/testsuite/g++.dg/ext/vector31.C b/gcc/testsuite/g++.dg/ext/vector31.C new file mode 100644 index 000000000000..a05683943151 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector31.C @@ -0,0 +1,29 @@ +// PR c++/71871 +// { dg-do compile } + +typedef unsigned int V __attribute__ ((__vector_size__ (32))); + +template +void +foo (V *x) +{ + V a = *x; + a = a ? a : -1; + *x = a; +} + +template +void +bar (T *x) +{ + T a = *x; + a = a ? a : -1; + *x = a; +} + +void +test (V *x, V *y) +{ + foo<0> (x); + bar (y); +}