On Sun, Jan 30, 2022 at 11:11:15AM +0000, Jonathan Wakely wrote:
> On Sun, 30 Jan 2022, 10:58 Jakub Jelinek, <ja...@redhat.com> wrote:
> 
> > On Sun, Jan 30, 2022 at 10:50:56AM +0000, Jonathan Wakely wrote:
> > > We could put a trap instruction at the end of the function though, which
> > > would make the result a bit less arbitrary.
> > >
> > > I've come around to thinking that's preferable for cases like this.
> >
> > Depends on which exact cases.
> > Because for
> > int foo (int s) { if (s == 123) return 1; }
> > we want to optimize it into
> > return 1;
> > rather than if (s == 123) return 1; else __builtin_trap ();
> > For debugging we have -fsanitize=undefined
> 
> 
> What if we inserted the trap for -O0?

Adding a trap for -O0 looks reasonable to me, after all, we aren't going to
do too many optimizations with __builtin_unreachable at -O0 anyway.

        Jakub

Reply via email to