Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated PUBLIC :: <id> statement #66

Open
clementval opened this issue Jun 25, 2018 · 4 comments
Open

Duplicated PUBLIC :: <id> statement #66

clementval opened this issue Jun 25, 2018 · 4 comments

Comments

@clementval
Copy link
Collaborator

clementval commented Jun 25, 2018

The following code is not compilable after going through the front-end/back-end workflow.

MODULE mod1
  IMPLICIT NONE
  PRIVATE

  INTERFACE netcdf_read_att_int
    MODULE PROCEDURE netcdf_read_att_int
  END INTERFACE netcdf_read_att_int

CONTAINS
  FUNCTION netcdf_read_att_int() result(res)
    INTEGER                      :: res
  END FUNCTION netcdf_read_att_int
END MODULE mod1

The resulting code shown below has two PUBLIC :: netcdf_read_att_int declaration which is not correct according to the standard.

MODULE mod1
 PRIVATE :: netcdf_read_att_int
 PRIVATE :: netcdf_read_att_int
 INTERFACE netcdf_read_att_int
   MODULE PROCEDURE netcdf_read_att_int
 END INTERFACE

CONTAINS
 FUNCTION netcdf_read_att_int () RESULT(res)
  INTEGER :: res
 END FUNCTION netcdf_read_att_int

END MODULE mod1
out.f90:3:30:

  PUBLIC :: netcdf_read_att_int
                              1
Error: ACCESS specification at (1) was already specified
@clementval
Copy link
Collaborator Author

@h-murai In your opinion, the two id from the interface and the function should be multilize CL_MULTI or they should be two distinct id?

@h-murai
Copy link
Collaborator

h-murai commented Aug 22, 2018

@clementval In my opinion, this case is actually an error because of a conflict of a name although gfortran accepts it. Another possible understanding is that the generic name from the interface overrides the internal function. I'm not sure which conforms to the standard...

@clementval
Copy link
Collaborator Author

@h-murai I'll try to have a look at the standard. I tried this example with Cray and PGI and both accept it as well

@h-murai
Copy link
Collaborator

h-murai commented Aug 24, 2018

@clementval For the current sample code, I think the id from the generic name and that from MODULE PROCEDURE, which is the same with the internal function, should be multilized.

It's the second case for CL_MULTI.

    CL_MULTI,     /* Both the derived type name and the generic procedure name
                   * OR
                   * Both the interface name and the generic procedure name */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants