https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118613
Bug ID: 118613
Summary: maxval/minval may evaluate argument too often
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
Created attachment 60242
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60242&action=edit
Testcase
Found while looking into pr118580. The argument of minval/maxval may be
evaluated more often than expected.
The attached program prints:
4 0
4 0
6 0.00000000
5 0.00000000
6 0.00000000
5 0.00000000
Expected:
4 0
4 0
4 0.00000000
4 0.00000000
4 0.00000000
4 0.00000000
The latter is confirmed by other brands (e.g. Intel).