← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Remove check for undefined behaviour

 

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
> 



Follow ups

References