<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 12/10/2014 9:26 PM, Colin Riddell
wrote:<br>
</div>
<blockquote class=" cite" id="mid_54886D3D_7090807_codeplay_com"
cite="mid:54886D3D.7090807@codeplay.com" type="cite">
<br>
<blockquote class=" cite" id="Cite_1093518" type="cite">Also my
mistake about the error not showing up. The actual example that
I tried was "float2 = char2 ? float : float". Attached the
modified copy that I had created from your original lit test.
This requires your patch to avoid the assertion. I believe this
assignment should not cause any error at all.
<br>
</blockquote>
Agreed, and thanks for the test. Added that to the patch.
<br>
</blockquote>
<br>
Erm ... turns out that my test is wrong for a different reason! The
expression "char2 ? float : float" is not compatible with the select
builtin because the number of bits in the element types needs to be
the same. I am guessing that this bitness issue might have been the
original inspiration for casting to CondTy instead of ResTy, that
you fixed. But your fix is correct within its context.<br>
<br>
<blockquote class=" cite" id="mid_54886D3D_7090807_codeplay_com"
cite="mid:54886D3D.7090807@codeplay.com" type="cite">It's worth
pointing out that the select generation is handled in
CGExprScalar.cpp Value *ScalarExprEmitter::
<br>
VisitAbstractConditionalOperator()
<br>
</blockquote>
<br>
Thanks! That actually saved me from embarking on a spelunking
expedition! :D<br>
<br>
<blockquote class=" cite" id="mid_54886D3D_7090807_codeplay_com"
cite="mid:54886D3D.7090807@codeplay.com" type="cite">
Attached is another patch for review, including both tests. Now
ignore the first patch I submitted. This new change passes all the
tests run with check-clang.
<br>
</blockquote>
<br>
There could be more to this than the existing tests. Please see the
attached document where I have described my understanding of how the
ternary operator is supposed to work. Would appreciate any faults
that you find! I hope it is not overkill, but the effort was already
useful --- it helped me discover that my testcase above is invalid.
Another example which we discussed in previous emails is also wrong:
"float ? char : unsigned", because the condition cannot be a
floating point type.<br>
<br>
Sameer.<br>
<br>
</body>
</html>