typeck.c (cp_build_binary_op): Call save_expr before build_vector_from_val.

2013-05-06  Marc Glisse  <marc.glisse@inria.fr>

gcc/cp/
	* typeck.c (cp_build_binary_op): Call save_expr before
	build_vector_from_val.

gcc/testsuite/
	* c-c++-common/vector-scalar-2.c: New testcase.

From-SVN: r198648
This commit is contained in:
Marc Glisse 2013-05-06 23:11:24 +02:00 committed by Marc Glisse
parent f2c17ea905
commit 6698175d15
4 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2013-05-06 Marc Glisse <marc.glisse@inria.fr>
* typeck.c (cp_build_binary_op): Call save_expr before
build_vector_from_val.
2013-05-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57183

View File

@ -3972,6 +3972,7 @@ cp_build_binary_op (location_t location,
return error_mark_node;
case stv_firstarg:
{
op0 = save_expr (op0);
op0 = convert (TREE_TYPE (type1), op0);
op0 = build_vector_from_val (type1, op0);
type0 = TREE_TYPE (op0);
@ -3981,6 +3982,7 @@ cp_build_binary_op (location_t location,
}
case stv_secondarg:
{
op1 = save_expr (op1);
op1 = convert (TREE_TYPE (type0), op1);
op1 = build_vector_from_val (type0, op1);
type1 = TREE_TYPE (op1);

View File

@ -1,3 +1,7 @@
2013-05-06 Marc Glisse <marc.glisse@inria.fr>
* c-c++-common/vector-scalar-2.c: New testcase.
2013-05-06 Maxim Kuznetsov <maks.kuznetsov@gmail.com>
* gcc.target/i386/asm-dialect-2.c: New testcase.

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-fdump-tree-gimple" } */
typedef int veci __attribute__ ((vector_size (4 * sizeof (int))));
int c;
void f (veci *a)
{
*a = *a + ++c;
}
/* { dg-final { scan-tree-dump-times " \\\+ 1" 1 "gimple" } } */
/* { dg-final { cleanup-tree-dump "gimple" } } */