Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-26 Thread Richard Biener
On Wed, Jul 26, 2017 at 1:35 PM, Marek Polacek wrote: > On Tue, Jul 25, 2017 at 03:47:31PM +0200, Richard Biener wrote: >> On Tue, Jul 25, 2017 at 3:30 PM, Eric Botcazou wrote: >> >> Eric, any comments? >> > >> > No objection for the build2_stat hunk, I think it's in keeping with the Ada >> > sem

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-26 Thread Marek Polacek
On Tue, Jul 25, 2017 at 03:47:31PM +0200, Richard Biener wrote: > On Tue, Jul 25, 2017 at 3:30 PM, Eric Botcazou wrote: > >> Eric, any comments? > > > > No objection for the build2_stat hunk, I think it's in keeping with the Ada > > semantics. But the tree_could_trap_p hunk is certainly an abomin

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-25 Thread Richard Biener
On Tue, Jul 25, 2017 at 3:30 PM, Eric Botcazou wrote: >> Eric, any comments? > > No objection for the build2_stat hunk, I think it's in keeping with the Ada > semantics. But the tree_could_trap_p hunk is certainly an abomination... > >> We could also avoid tree_could_trap_p by special-casing only

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-25 Thread Eric Botcazou
> Eric, any comments? No objection for the build2_stat hunk, I think it's in keeping with the Ada semantics. But the tree_could_trap_p hunk is certainly an abomination... > We could also avoid tree_could_trap_p by special-casing only > *_DIV_EXPR and *_MOD_EXPR > with integer zero 2nd operand e

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-25 Thread Richard Biener
On Tue, Jul 25, 2017 at 2:19 PM, Marek Polacek wrote: > On Thu, Jul 20, 2017 at 08:22:59PM +0200, Richard Biener wrote: >> No, we shouldn't. Maybe trapping ops shouldn't be marked TREE_CONSTANT? >> (Make sure to test with Ada...) > > That works for both testcases, but I can't say I really like th

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-25 Thread Marek Polacek
On Thu, Jul 20, 2017 at 08:22:59PM +0200, Richard Biener wrote: > No, we shouldn't. Maybe trapping ops shouldn't be marked TREE_CONSTANT? > (Make sure to test with Ada...) That works for both testcases, but I can't say I really like the idea of modifying build2... but it's where the TREE_CONSTANT

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-20 Thread Richard Biener
On July 20, 2017 4:20:00 PM GMT+02:00, Marek Polacek wrote: >On Thu, Jul 20, 2017 at 12:55:10PM +0200, Richard Biener wrote: >> On Wed, Jul 19, 2017 at 3:55 PM, Marek Polacek >wrote: >> > On Wed, Jul 19, 2017 at 12:45:12PM +0200, Richard Biener wrote: >> >> On Tue, Jul 18, 2017 at 6:05 PM, Marek

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-20 Thread Marek Polacek
On Thu, Jul 20, 2017 at 12:55:10PM +0200, Richard Biener wrote: > On Wed, Jul 19, 2017 at 3:55 PM, Marek Polacek wrote: > > On Wed, Jul 19, 2017 at 12:45:12PM +0200, Richard Biener wrote: > >> On Tue, Jul 18, 2017 at 6:05 PM, Marek Polacek wrote: > >> > We ended up in infinite recursion between e

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-20 Thread Richard Biener
On Wed, Jul 19, 2017 at 3:55 PM, Marek Polacek wrote: > On Wed, Jul 19, 2017 at 12:45:12PM +0200, Richard Biener wrote: >> On Tue, Jul 18, 2017 at 6:05 PM, Marek Polacek wrote: >> > We ended up in infinite recursion between extract_muldiv_1 and >> > fold_plusminus_mult_expr, because one turns thi

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-19 Thread Marek Polacek
On Wed, Jul 19, 2017 at 12:45:12PM +0200, Richard Biener wrote: > On Tue, Jul 18, 2017 at 6:05 PM, Marek Polacek wrote: > > We ended up in infinite recursion between extract_muldiv_1 and > > fold_plusminus_mult_expr, because one turns this expression into the other > > and the other does the rever

Re: [PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-19 Thread Richard Biener
On Tue, Jul 18, 2017 at 6:05 PM, Marek Polacek wrote: > We ended up in infinite recursion between extract_muldiv_1 and > fold_plusminus_mult_expr, because one turns this expression into the other > and the other does the reverse: > > ((2147483648 / 0) * 2) + 2 <-> 2 * (2147483648 / 0 + 1) > > I tr

[PATCH] Fix infinite recursion with div-by-zero (PR middle-end/70992)

2017-07-18 Thread Marek Polacek
We ended up in infinite recursion between extract_muldiv_1 and fold_plusminus_mult_expr, because one turns this expression into the other and the other does the reverse: ((2147483648 / 0) * 2) + 2 <-> 2 * (2147483648 / 0 + 1) I tried (unsuccessfully) to fix it in either extract_muldiv_1 or fold_p