[Bug fortran/78676] Optimizer bug exposed by program with many bit operations.

2016-12-04 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78676

--- Comment #3 from Andrew Pinski  ---
Try -fwrapv .

[Bug fortran/78676] Optimizer bug exposed by program with many bit operations.

2016-12-04 Thread mecej4 at operamail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78676

--- Comment #2 from mecej4 at operamail dot com ---
(In reply to Andrew Pinski from comment #1)
> This sounds like overflows are happening. Overflow in fortran is undefined.

Very much so, but integer overflow happens a lot in random number generation
routines, where the algorithms usually employ unsigned integer arithmetic.
There is a long tradition of Fortran compilers ignoring integer overflow and
this feature is being exploited to implement RNG programs. 

If the compiler's error trapping capability includes detecting integer
overflow, that should be turned off for running the test program (or
Marsaglia's RNG software). For example, with the NAG Fortran compiler the -C
option makes some checking happen, but integer overflow is not checked. There
is a -C=all option that traps overflow, so it should definitely not be used.

[Bug fortran/78676] Optimizer bug exposed by program with many bit operations.

2016-12-04 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78676

--- Comment #1 from Andrew Pinski  ---
This sounds like overflows are happening. Overflow in fortran is undefined.