On Thu, 3 Feb 2022, Jakub Jelinek wrote: > On Thu, Feb 03, 2022 at 10:40:10AM +0100, Richard Biener wrote: > > Yes, we definitely have multiple of those cases. I do think > > preserving "an idiom", for example literal 0/0 or all x/0 might be > > worth considering. But I also think we have to sort out different > > language standards requirements vs. the middle-end and whos > > responsible for making sure we adhere here. > > I think we try to preserve literal 0/0 and x/0, including this > optimization which punts if the divisor is literal. But, for literal > 0/0 and x/0 we alsy emit -Wdiv-by-zero warning, maybe that was the > reason why libgcc2.c did it differently.
Sure, I bet the code is quite old since we very likely propagate the equality and optimize the division away since a long time. Now that #pragma GCC diagnostic is a thing we can probably write literal 0/0 if we choose to preserve that until the end. But as said, for the libgcc2.c case I'd simply remove all of it. Richard.