On Thu, Oct 27, 2011 at 7:02 PM, Richard Smith <[email protected]> wrote: > Hi, > > The attached patch moves the checking for vector operations after the usual > arithmetic conversions are performed. This matters because: > > * The OpenCL specification requires that we perform the usual arithmetic > conversions on vectors (although it requires changes to the conversions > themselves, which we do not yet implement). > * The lvalue-to-rvalue conversion on vector operands is otherwise missing in > many cases (leading to problems with analysis passes, and soon with C++11 > constant evaluation). > > The patch adds both some tests and a new assert that ImpCastExprToType doesn't > accidentally cast an lvalue to an rvalue; this assert fires on the new tests > without the rest of the patch. > > I'm not very familiar with the vector handling code, so I'd appreciate someone > looking over the patch and the approach to make sure that it's reasonable. > > > One unit test changed behavior (for an ext_vector_type vector): > > ish8 += 5; // expected-error {{...}} > ish8 += (short)5; > > We now reject the second line just like the first, since the short is promoted > back to int before being assigned. However, according to the OpenCL > specification (which I've been informed that ext_vector_type is supposed to > support), both of these lines should be legal.
The test is correct as-is. Try reading the section on usual arithmetic conversions again. Please just fix CheckVectorOperands to call DefaultFunctionArrayLvalueConversion. -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
