This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34335] New: valid code rejected when reordering USE statements
- From: "jaydub66 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2007 13:37:24 -0000
- Subject: [Bug fortran/34335] New: valid code rejected when reordering USE statements
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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