aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c/c-typeck.cc4
-rw-r--r--gcc/cp/typeck.cc7
-rw-r--r--gcc/testsuite/c-c++-common/pr107358.c30
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr68180.C2
4 files changed, 38 insertions, 5 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index fdb96c2..92f3afc 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -11995,8 +11995,8 @@ build_binary_op (location_t location, enum tree_code code,
if ((gnu_vector_type_p (type0) && code1 != VECTOR_TYPE)
|| (gnu_vector_type_p (type1) && code0 != VECTOR_TYPE))
{
- enum stv_conv convert_flag = scalar_to_vector (location, code, op0, op1,
- true);
+ enum stv_conv convert_flag = scalar_to_vector (location, code, orig_op0,
+ orig_op1, true);
switch (convert_flag)
{
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 16e7d85..530d260b 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5191,6 +5191,8 @@ cp_build_binary_op (const op_location_t &location,
orig_type0 = type0 = TREE_TYPE (op0);
orig_type1 = type1 = TREE_TYPE (op1);
+ tree non_ep_op0 = op0;
+ tree non_ep_op1 = op1;
/* The expression codes of the data types of the arguments tell us
whether the arguments are integers, floating, pointers, etc. */
@@ -5303,8 +5305,9 @@ cp_build_binary_op (const op_location_t &location,
if ((gnu_vector_type_p (type0) && code1 != VECTOR_TYPE)
|| (gnu_vector_type_p (type1) && code0 != VECTOR_TYPE))
{
- enum stv_conv convert_flag = scalar_to_vector (location, code, op0, op1,
- complain & tf_error);
+ enum stv_conv convert_flag
+ = scalar_to_vector (location, code, non_ep_op0, non_ep_op1,
+ complain & tf_error);
switch (convert_flag)
{
diff --git a/gcc/testsuite/c-c++-common/pr107358.c b/gcc/testsuite/c-c++-common/pr107358.c
new file mode 100644
index 0000000..4ab75e0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr107358.c
@@ -0,0 +1,30 @@
+/* PR c++/107358 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fexcess-precision=standard" } */
+
+typedef float __attribute__((vector_size (4 * sizeof (float)))) A;
+typedef double __attribute__((vector_size (2 * sizeof (double)))) B;
+
+void
+foo (A *x)
+{
+ *x = *x - 124.225514990f;
+}
+
+void
+bar (A *x, float y)
+{
+ *x = *x - y;
+}
+
+void
+baz (B *x)
+{
+ *x = *x + 124.225514990f;
+}
+
+void
+qux (B *x, double y)
+{
+ *x = *x + y;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr68180.C b/gcc/testsuite/g++.dg/cpp1y/pr68180.C
index 64d613e..9e6e5e9 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr68180.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr68180.C
@@ -1,6 +1,6 @@
// PR c++/68180
// { dg-do compile { target c++14 } }
-// { dg-additional-options "-Wno-psabi -fexcess-precision=fast" }
+// { dg-additional-options "-Wno-psabi" }
typedef float __attribute__( ( vector_size( 16 ) ) ) float32x4_t;
constexpr float32x4_t fill(float x) {