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

--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Thank you for the suggested workaround. This can certainly be helpful in the
> short term.  However, we would not want to rely on tuning compiler
> optimization switches in the future to ensure correct code operation.  ...

You can do the inlining in your code, e.g.,

--- pr71544.f90 2016-06-15 18:54:59.000000000 +0200
+++ pr71544_db.f90      2016-06-28 10:06:17.000000000 +0200
@@ -7,10 +7,12 @@ end module store_cptr

 subroutine init()
     use, intrinsic :: iso_c_binding
+    use store_cptr
     implicit none
     integer(c_int), pointer :: a
     allocate(a)
-    call save_cptr(c_loc(a))
+!    call save_cptr(c_loc(a))
+    cptr = c_loc(a)
     a = 100
 end subroutine init

Reply via email to