Chris Lattner wrote:
> On Feb 17, 2008, at 11:17 AM, Eli Friedman wrote:
>
>   
>> On Feb 17, 2008 10:30 AM, Török Edwin <[EMAIL PROTECTED]> wrote:
>>     
>>> From my reading of the C99 standard (N1256.pdf) calling foo with
>>> parameters when it is declared as foo() is allowed only if the
>>> declaration doesn't involve a definition too.
>>> If it involves a definition, then you can't call it with parameters,
>>> and foo() is equivalent to foo(void). Is this correct?
>>>       
>> See http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_317.htm.
>> Essentially, executing the call is technically undefined behavior, but
>> it's a perfectly legal construct.  I've filed
>> http://llvm.org/bugs/show_bug.cgi?id=2042 on the issue.
>>
>> It looks like your module does actually execute such an undefined
>> call, so the program technically has undefined behavior.

Thanks for the pointer.

>>   That said,
>> I've never heard of a C compiler producing code that actually did
>> anything weird... generally, C calling conventions allow for an
>> arbitrary number of arguments even if the callee doesn't expect them
>> for compatibility reasons.
>>     

I've filed a bug for the original program to avoid the undefined behaviour.

>
> I just checked in a fix for this,

Thanks a lot!

Best regards,
--Edwin
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to