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

--- Comment #24 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #23)
> I have the feeling that some other use also disagrees between ME and
> FE/Fortran semantics assumptions.
> 
> I just run into PR 92703: if one comments the unrelated 'foo', with -O0 one
> gets the expected 'stop 2' but with -O1 one gets 'stop 21' as (effectively)
> the 'class.20._data = &var;' has been optimized away. — For that PR, to
> properly handle Fortran semantic, a copy of 'var' had to be created and used
> instead. I think that would have solved the alias/ME problem for *that*
> usage/test case.

Note it's not the semantic of the Fortran language that matters but the
actual semantics of the GFortran frontend generated IL that does.  If
the Fortran language says for INTENT(IN) the variable isn't modified but
the underlying IL GFortran creates does exactly that then this is what
matters when you compute what to describe to the middle-end since the
middle-end cannot distinguish between "The Fortran Code" and the
"GFortran Implementation Details".

For example array descriptor handling is an important implementation detail
and INTENT() probably does _not_ talk about modifications/ownership of those.

Reply via email to