> void f(int (*)[10]);
> void f(int (*)[]);
> void g() {
>   int x[5];
>   f(&x);
> }
>
> gcc gives "warning: passing argument 1 of ‘f’ from incompatible
> pointer type"; clang should print a similar warning.

Added. This required changing/fixing initialization sequences to use
the type from the function prototype instead of the one from the
argument.

>> What is the behavior you would expect from CodeGen? Given
>>
>> void f(int);
>> void f(a)
>>   char a;
>> {
>>   int v[sizeof(a) == 1 ? 1 : -1];
>> }
>>
>> Should it produce a f(i32) that truncates its argument?
>
> Yes, this should continue to work the same way it works on trunk.

A new patch is attached. The codegen is not identical in all cases,
for example, given

int svc_register (void (*dispatch) (int));
int svc_register (dispatch)
     void (*dispatch) ();
{}

without this patch we produce "@svc_register(void (...)* %dispatch)"
and with it we produce "@svc_register(void (i32)*)", which I think is
the desired result.

> -Eli

Cheers,
Rafael

Attachment: t.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to