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

            Bug ID: 100776
           Summary: Error in automatic object of parameterized derived
                    type
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: furquan2011 at gmail dot com
  Target Milestone: ---

gfortran gives a compilation error while trying to use an automatic object of a
parameterized derived type. For example, trying to compile

```
module vector                                                                   
  type :: vec(dimen)                                                            
    integer,len :: dimen                                                        
    real        :: e(dimen)                                                     
  end type vec                                                                  

contains                                                                        
  function double(a)                                                            
    type(vec(*)),intent(in) :: a                                                
    type(vec(a%dimen))      :: double                                           

    double%e = 2.*a%e                                                           
  end function double                                                           
end module vector

results into the following error:
Error: The AUTOMATIC object ‘double’ at (1) must not have the SAVE attribute or
be a variable declared in the main program, a module or a submodule(F08/C513)

As much as I know, there is no SAVEd variable here. The code works without
issues with intel and NAG compilers.
  • [Bug fortran/100776] New: Error ... furquan2011 at gmail dot com via Gcc-bugs

Reply via email to