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

--- Comment #6 from cesar at gcc dot gnu.org ---
(In reply to Thomas Schwinge from comment #5)
> (In reply to cesar from comment #4)

> Are you saying that's not how the Fortran front end operates, and the
> "SUBROUTINE r_w" and the later "PROGRAM main" do see completly detached
> "decl spaces"?  Then indeed, we can't verify this in the Fortran front end,
> but...

Yes, the address spaces are completely detached in separate, external function.
Internal functions, i.e. those that are places after "contains:" share the same
scope as the main program/module block. 

Keep in mind that fortran has a lot of intrinsic procedures, so those find
function/subroutine functions mostly resolve those intrinsic procedures or
procedures explicitly declared by the user.

> > especially if lto is not enabled. If lto
> > is enabled, we could add some more checking in pass oacc_device_lower.
> 
> ..., as discussed before, something like that is the final goal that I'm
> working on, and for that...
> 
> > But I
> > don't think there's anything else to do in the fortran front end.
> 
> ..., please implement the changes I asked you to implement in Comment 3,
> #c3, or elaborate why that doesn't make sense.

That's a good idea in principle, but there are a couple of reasons why I'm
hesitant to pursue it.

a) The fortran pretty printer doesn't know about generic tree notes.
Consequently, I don't think build_oacc_routine_dims would be able to report any
errors unless we add support for tree notes in that pretty printer.

b) The fortran FE handle errors slightly differently from the c FE. Instead of
catching the error early and aborting immediately, you're method will defer the
error handling to after the FE has parsed everything. I'm not sure if this is a
problem or not.

c) That oacc_function information needs to be captured for fortran module .mod
files, and those .mod files don't require tree node attributes. Postponing that
attribute requires separate functions to manipulate the routine clauses.

d) gfc_oacc_routine_dims is already creating an oacc_function attribute for
routines. This attribute is a single enum instead of the individual clauses. I
like that because its more self contained.

Reply via email to