Re: [PATCH] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch

2017-04-20 Thread Peter Bergner
On 4/20/17 2:37 AM, Richard Biener wrote: > Ok, so I think we should ensure that we remove the regular cases > with unreachable destination, like in > > switch (i) > { > case 0: > __builtin_unreachable (); > default:; > } > > and handle default with __builtin_unreachable () from switch >

Re: [PATCH] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch

2017-04-20 Thread Richard Biener
On Thu, 13 Apr 2017, Peter Bergner wrote: > Bah, fixing up my return address. > > > On 4/13/17 3:14 AM, Richard Biener wrote: > > To recap the situation (from what I can deciper out of the ppc asm > > and the expand RTL) we seem to expand to > > > > if (cond > 2) > >

Re: [PATCH] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch

2017-04-13 Thread Peter Bergner
Bah, fixing up my return address. On 4/13/17 3:14 AM, Richard Biener wrote: > To recap the situation (from what I can deciper out of the ppc asm > and the expand RTL) we seem to expand to > > if (cond > 2) > __builtin_unreachable (); // jumps to the jump table data(?) > goto *tbl[cond];

Re: [PATCH] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch

2017-04-13 Thread Jakub Jelinek
On Thu, Apr 13, 2017 at 10:14:51AM +0200, Richard Biener wrote: > now I do not remember the reason why we keep __builtin_unreachable () > at the RTL level -- on GIMPLE we keep it to be able to extract I believe we don't. In RTL __builtin_unreachable () is represented as a basic block without

Re: [PATCH] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch

2017-04-13 Thread Richard Biener
On Wed, 12 Apr 2017, Peter Bergner wrote: > This patch is the second attempt to fix PR51513, namely the generation of > wild branches due to switch case statements that only contain calls to > __builtin_unreachable(). With the first attempt: > >