diff mbox

Fix PR53060

Message ID Pine.LNX.4.64.1204231217080.23071@jbgna.fhfr.qr
State New
Headers show

Commit Message

Richard Biener April 23, 2012, 10:18 a.m. UTC
This fixes a typo.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-04-23  Richard Guenther  <rguenther@suse.de>

	PR c/53060
	* c-typeck.c (build_binary_op): Fix typo.

	* gcc.dg/pr53060.c: New testcase.
diff mbox

Patch

Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c	(revision 186623)
+++ gcc/c-typeck.c	(working copy)
@@ -9733,7 +9733,7 @@  build_binary_op (location_t location, en
 	      sc = convert (TREE_TYPE (type0), sc);
 	      op1 = build_vector_from_val (type0, sc);
 	      if (!maybe_const)
-		op0 = c_wrap_maybe_const (op1, true);
+		op1 = c_wrap_maybe_const (op1, true);
 	      orig_type1 = type1 = TREE_TYPE (op1);
 	      code1 = TREE_CODE (type1);
 	      converted = 1;
Index: gcc/testsuite/gcc.dg/pr53060.c
===================================================================
--- gcc/testsuite/gcc.dg/pr53060.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr53060.c	(revision 0)
@@ -0,0 +1,24 @@ 
+/* { dg-do run } */
+
+extern void abort (void);
+
+int                     f(void) { return 2; }
+unsigned int            g(void) { return 5; }
+unsigned int            h = 1;
+
+typedef unsigned int vec __attribute__((vector_size(16)));
+
+vec i = { 1, 2, 3, 4};
+
+vec fv1(void) { return i + (h ? f() : g()); }
+vec fv2(void) { return (h ? f() : g()) + i; }
+
+int main()
+{
+  vec i, j;
+  j = fv1();
+  if (j[0] != 3) abort();
+  i = fv2();
+  if (i[0] != 3) abort();
+  return 0;
+}