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

            Bug ID: 99651
           Summary: Cannot change attributes of USE-associated intrinsic
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aserranot at aemet dot es
  Target Milestone: ---

Created attachment 50424
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50424&action=edit
Source files to reproduce the problem

When I make a minimal example, the problem does not appear. So, I have taken my
code and begun to simplify it while testing that, after each simplification,
the problem remains.

I use a fortran wrapper for the udunits by Michel Valin (Copyright Université
du Québec à Montréal) and it seems that when I erase the corresponding use
statement and all the variables of a type defined in the udunits2 wrapper, the
problem disapears. So I think that the problem is triggered in some way by that
module.

I attach my code and the module.

To compile, issue the following commands in a directory where you have the
files f_udunits_2.f90, f_udunits_2.inc and gfortran_bug_example.f90:

gfortran -J. -cpp -fno-realloc-lhs -fopenmp -fcheck=bounds -fcheck=all -g -O0 
-Wall   -c f_udunits_2.f90

gfortran -J. -cpp -fno-realloc-lhs -fopenmp -fcheck=bounds -fcheck=all -g -O0 
-Wall   -c gfortran_bug_example.f90 

In my system, the output from the last command is:
gfortran_bug_example.f90:41:53:

   41 |     type(typeNode),   pointer       :: Next => null()
      |                                                     1
Error: No se pueden cambiar los atributos del símbolo asociado con USE null en
(1)
gfortran_bug_example.f90:45:45:

   45 |     type(typeNode), pointer :: Head => null()
      |                                             1
Error: No se pueden cambiar los atributos del símbolo asociado con USE null en
(1)
gfortran_bug_example.f90:46:45:

   46 |     type(typeNode), pointer :: Last => null()
      |                                             1
Error: No se pueden cambiar los atributos del símbolo asociado con USE null en
(1)
gfortran_bug_example.f90:62:30:

   62 |         class(typeFieldsList)   :: FieldsList
      |                              1
Error: Derived type ‘typefieldslist’ at (1) is being used before it is defined
gfortran_bug_example.f90:66:30:

   66 |         class(typeFieldsList)               :: Fields
      |                              1
Error: Derived type ‘typefieldslist’ at (1) is being used before it is defined
gfortran_bug_example.f90:67:25:

   67 |         class(typeField),       intent(in)  :: Field
      |                         1
Error: Derived type ‘typefield’ at (1) is being used before it is defined
gfortran_bug_example.f90:71:30:

   71 |         class(typeFieldsList),  target              :: Fields
      |                              1
Error: Derived type ‘typefieldslist’ at (1) is being used before it is defined
gfortran_bug_example.f90:73:25:

   73 |         class(typeField), pointer     :: Ptr
      |                         1
Error: Derived type ‘typefield’ at (1) is being used before it is defined

Reply via email to