https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107373
Bug ID: 107373 Summary: Unexpected result with loop optimisation Product: gcc Version: 8.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: raphael.monod at wanadoo dot fr Target Milestone: --- Created attachment 53765 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53765&action=edit Source of test producing the bug (MWE) The attached test show the vector "tab_int_from_logical" contains -1, although +1 are expected. Compiler option -O3 is required to get this bug. Adding a print in the loop go around it. Degreasing the dimension 'IDIM' from 16 to 15 go around it. I do not have test all GCC releases, but I met this bug with release : 7.3.0, 8.2.0, 8.5.0, 9.4.0. Everything is good with releases 6.3.0, 11.3.0, 12.1.0 I known that releases used to produce this bug are no longer supported, bug I think that debian 10 (which is again supported) use 8.x GCC release.