[PATCH] D21700: [SemaExpr] Support lax conversions in assignments with vector and scalars with same size

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 10:11:27 PDT 2016


rnk added a comment.

After writing r266366, we discovered that GCC accepts none of the code in that test case, so we should consider turning -flax-vector-conversions off by default.


================
Comment at: test/Sema/vector-cast.c:65
@@ -59,1 +64,3 @@
+  d = f2;
+  d = d + f2;
 }
----------------
Why should we allow this conversion? I don't see how <2 x float> and double should be convertible. I'm not sure why we allow `f2 += d` above, but I think of it as "widening" the type from scalar to vector.

Would it be OK for your if we tightened our lax vector conversion checks to just allow conversion from `<1 x T>` to `T`? The test case in the summary seems like pretty reasonable code, even if GCC rejects.


http://reviews.llvm.org/D21700





More information about the cfe-commits mailing list