← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Remove check for undefined behaviour

 

On 9/28/2016 7:10 PM, Chris Pavlina wrote:
> A part of me wants to say "just being in the KiCad source tree should do
> that". But that's a bit mean, isn't it ^-^

That's funny!  This code is actually a third party library so we can
only take credit for including it in KiCad. ;)

> 
> Maybe paste an excerpt from your rant in a comment :D

I would if I thought it would do any good.

> 
> On Wed, Sep 28, 2016 at 06:55:47PM -0400, Wayne Stambaugh wrote:
>> Thanks Simon.  Chris already tested this.  I just haven't got around to
>> merging the patch.  One positive thing about leaving this code in place
>> is it should raise a red flag to anyone who looks at it.  Removing this
>> code is going to hide the true ugliness that lies underneath it.
>>
>> Wayne
>>
>> On 9/28/2016 6:44 PM, Simon Richter wrote:
>>> Hi,
>>>
>>> On 28.09.2016 17:57, Wayne Stambaugh wrote:
>>>
>>>> I didn't test what the compiler generated but I suspected that was the
>>>> case from warning message. If that's the case then I will apply the
>>>> patch but it does mask the underlying issue which could fail spectacularly.
>>>
>>> That is what happens:
>>>
>>> #include <exception>
>>>
>>> void foo(int &i)
>>> {
>>>         if(&i == 0)
>>>                 std::terminate();
>>> }
>>>
>>> $ g++ -O2 -c tt.cpp
>>>
>>> 0000000000000000 <foo(int&)>:
>>>    0:   f3 c3                   repz retq
>>>
>>> So the test is indeed optimized out.
>>>
>>>    Simon
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp



References