← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Remove check for undefined behaviour

 

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

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References