http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53667

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
                 CC|                            |burnus at gcc dot gnu.org
          Component|fortran                     |middle-end
         Resolution|INVALID                     |

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-14 
09:07:25 UTC ---
(In reply to comment #1)
> Looks like undefined code to me.  The storage is not large enough.

I disagree: "oh" is 64 bits which should be enough to store a pointer - as is
the Cray pointer "pobj". And "obj", the Cray pointee, is with 3*8 bytes large
enough to store three 8-byte values.


My guess had been that the ME should be able to see that the assignments modify
"object_holder" - thus I assigned the PR to the middle-end.


Note: As Cray pointers are a (Fortran 77) vendor extension, there is no
specification. Thus, it is impossible to tell whether the code is valid or not.
Additionally, "TARGET" (which removes the "restrict") does not exist in Fortran
77.


The program successfully runs with ifort, openf95, pathf95, but it fails with
PGI and Cray at the "print" line (illegal instruction) - even without
optimization.


Thus, if it is not trivially fixable, one can really consider to close it as
WONTFIX.

[Or to apply in the Fortran FE as mitigating bugfix something like
http://gcc.gnu.org/ml/fortran/2012-06/msg00082.html, which marks the integer
variables as TARGET in the most common cases. One should probably additionally
handle "oh = malloc(...)" and "free(oh)".]


The same issue also occurs with -O1 if one replaces the main program by
manually inlining "set_vals":

  integer*8 :: object_holder
  integer*8 :: obj(3)
  pointer(pobj, obj)

  call object_holder_init(object_holder)
  pobj = object_holder
  obj(1) = 900
  obj(2) = 800
  obj(3) = 700
  call print_vals(object_holder)

Reply via email to