<div dir="ltr"><div><div>Hello,<br><br></div>Using a type incompatible pointer to call a function has undefined behavior (6.3.2.3).<br></div><div>As for the tests, I don't know...maybe we want specific behavior within LLVM for these cases?<br>
<br></div><div>Pete<br><br></div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 30, 2013 at 11:41 AM, Matt Arsenault <span dir="ltr"><<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><div class="im">
<div>On 05/30/2013 06:12 AM, Pete Couperus
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>Hello,<br>
<br>
</div>
This is an interesting example. Whenever I see strange
things like this, I use opt's -lint.<br>
</div>
In this case, opt -lint reports:<br>
Undefined behavior: Call return type mismatches callee return
type<br>
%call = call float @alias_f32(float %tmp2) #1<br>
<br>
</div>
<div>You'll get a similar report when the parameter types
mismatch.<br>
<br>
</div>
<div>Pete<br>
</div>
</div>
</blockquote>
<br></div>
Is it really supposed to be undefined? The tests are checking for
specific behavior in these "undefined" cases.<br>
<br>
opt -lint < test/Transforms/InstCombine/call.ll<br>
<br>
Undefined behavior: Call argument type mismatches callee parameter
type<br>
call void bitcast (void (i8*)* @test1a to void (i32*)*)(i32* %A)<br>
Undefined behavior: Call argument type mismatches callee parameter
type<br>
call void bitcast (void (i8)* @test2a to void (i32)*)(i32 %A)<div class="im"><br>
Undefined behavior: Call return type mismatches callee return type<br></div>
%X = call i32 bitcast (i8 ()* @test4a to i32 ()*)()<br>
Undefined behavior: Call argument count mismatches callee argument
count<br>
%X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)()<br>
Undefined behavior: Call argument count mismatches callee argument
count<br>
call void bitcast (void ()* @test7a to void (i32)*)(i32 5)<br>
<br>
</div>
</blockquote></div><br></div>