https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118259

--- Comment #3 from mjr19 at cam dot ac.uk ---
That is a very interesting point. If I change the constants in the random
number generator to

    seed=iand(seed*110+123,z'7fffffff')

then the answer with '-O3' is

           0           0
           1          47
          22          34
          15          -9
           2          24

and with '-O3 -fno-inline' is

           0           0
           1          47
          22          34
          15          40
           2          24

It is certainly surprising to imagine that the answer could ever include a
negative number, but, given that the behaviour is undefined, surprises are
permitted. I will see if I can find an example which does not include an
integer overflow, but until I can, I think this is resolved as invalid.

Reply via email to