Re: How to deal with the different result when executing UB programs?

2020-05-22 Thread Haoxin Tu via Gcc
Ok, thanks.

Jonathan Wakely 于2020年5月22日 周五14:21写道:

> On Fri, 22 May 2020 at 06:54, Haoxin Tu via Gcc  wrote:
> >
> > Hi, there!
> >
> > I am new for using GCC mail list, please forgive me if something is
> wrong.
>
> You're using the wrong mailing list, see
> https://gcc.gnu.org/lists.html which says this question should be on
> the gcc-help list. Please send any replies there instead.
>
> > I have some issues about how GCC deal with the different optimizations
> in a
> > UB program.
>
> It's undefined. Anything can happen. We're not going to define the
> behaviour of undefined behaviour, because it's undefined.
>
> https://en.wikipedia.org/wiki/Undefined_behavior
> https://en.cppreference.com/w/cpp/language/ub
>


Re: How to deal with the different result when executing UB programs?

2020-05-22 Thread Jonathan Wakely via Gcc
On Fri, 22 May 2020 at 06:54, Haoxin Tu via Gcc  wrote:
>
> Hi, there!
>
> I am new for using GCC mail list, please forgive me if something is wrong.

You're using the wrong mailing list, see
https://gcc.gnu.org/lists.html which says this question should be on
the gcc-help list. Please send any replies there instead.

> I have some issues about how GCC deal with the different optimizations in a
> UB program.

It's undefined. Anything can happen. We're not going to define the
behaviour of undefined behaviour, because it's undefined.

https://en.wikipedia.org/wiki/Undefined_behavior
https://en.cppreference.com/w/cpp/language/ub