[llvm-dev] Function Inlining and undef / poison question

mats petersson via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 15 16:42:39 PDT 2017


On 16 June 2017 at 00:35, John Regehr via llvm-dev <llvm-dev at lists.llvm.org>
wrote:

> void F(int a)
>> {
>>     if (a == a) do_stuff();
>> }
>>
>> ....
>> main()
>> {
>>     int x;
>>     F(x);
>> }
>>
>
> This C program unconditionally executes UB and any translation at all is
> acceptable -- end of story.
>

I understand that is the "letter of the law". However, I can see the
argument for something that behaves in a predictable way, whether for
example F is defined in a header file or in a separate translation unit -
and I believe the example here is one where that would make a difference -
even if the compller is perfectly fine to produce something that plays the
theme tune to Mony Python's Flying Circus or prints 42 on the screen,
instead of whatever "do_stuff" does.

--
Mats

>
> John
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170616/7ff78150/attachment.html>


More information about the llvm-dev mailing list