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

--- Comment #27 from anlauf at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #26)
> It is included here:
> https://www.desy.de/~reuter/downloads/repro002.tar.xz
> I am working on a smaller example right now.

Good.  I can reproduce the failure, but here's what others need to know:

- I have to

rm -f nlo_9_p2.i1.phs nlo_9_p2.m1.vg2

  each time *before* running the test. ???

- I am using the modification to rng_stream_sub.f90 from comment#24 with the
  printout added

- I am switching between

      res = mod (x1, x2)

and
      res = x1 - int(x1/x2) * x2

- I am disabling optimization completely for this file and added to Makefile:

rng_stream_sub.o: rng_stream_sub.f90
        $(FC) $(FCFLAGS) -c $< -O0 -fdump-tree-original -fdump-tree-optimized


which gives (v1 is with intrinsic mod, v2 is with explicitly coded mod):

--- rng_stream_sub.f90.005t.original.v1 2023-06-29 20:44:58.148284991 +0200
+++ rng_stream_sub.f90.005t.original.v2 2023-06-29 20:45:45.408160849 +0200
@@ -3,7 +3,7 @@
 {
   real(kind=8) res;

-  res = __builtin_fmod (*x1, *x2);
+  res = *x1 - (real(kind=8)) (integer(kind=4)) (*x1 / *x2) * *x2;
   return res;
 }

as expected.  The dump-tree-optimized looks unsuspicious to me.

Reply via email to