This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34335] New: valid code rejected when reordering USE statements


Consider the following piece of code:


module A
  type A_type
    real comp
  end type
end module A

module B
  use A
  private
  type(A_type) :: B_var
  public:: B_var
end module B

program C
  use B
  use A
  type(A_type):: A_var
end program C


This is rejected with the error message

  type(A_type):: A_var
             1
Error: Derived type 'a_type' at (1) is being used before it is defined

Please note that the error is only thrown under the condition that the USE
statements in program C appear in the same order as shown above. When you
exchange them and put "use A" first (or remove "use B"), then the error goes
away. This makes me wonder if this bug is somehow related to PR33295.

Also the error only appears with the funny combination of PUBLIC and PRIVATE in
module B. Admittedly, it looks a little strange and is not very useful, but
nevertheless I think it's valid Fortran (someone correct me if I'm wrong).


-- 
           Summary: valid code rejected when reordering USE statements
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jaydub66 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34335


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]