public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/13930] New: derived type with intent(in) attribute not accepted
@ 2004-01-30 11:37 Mart dot Rentmeester at sci dot kun dot nl
2004-01-30 12:41 ` [Bug fortran/13930] [gfortran] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Mart dot Rentmeester at sci dot kun dot nl @ 2004-01-30 11:37 UTC (permalink / raw)
To: gcc-bugs
The following program fails to compile: the compiler generates
an error. It is however a compiler error, and not one in the
program as it says.
> gfortran -c x.f95
In file x.f95:25
function f1(f)
1
Error: Can't assign to INTENT(IN) variable 'f' at (1)
module gd
integer :: i = 0
type t
private
integer :: i = 0
end type
contains
!*******************************************************************************
function f2(f)
implicit none
integer, intent(in) :: f
integer :: f2
integer, external :: external_f
f2 = external_f(f)
end function f2
!*******************************************************************************
function f1(f)
implicit none
type(t), intent(in) :: f
integer :: f1
integer, external :: external_f
f1 = external_f(f%i)
end function f1
!*******************************************************************************
end module gd
--
Summary: derived type with intent(in) attribute not accepted
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Mart dot Rentmeester at sci dot kun dot nl
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/13930] [gfortran] derived type with intent(in) attribute not accepted
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
@ 2004-01-30 12:41 ` pinskia at gcc dot gnu dot org
2004-02-06 1:23 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-30 12:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-30 12:41 -------
Confirmed about the wrong line number gets outputted but I do not know fortran that much to say
about if this is valid or invalid code.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Summary|derived type with intent(in)|[gfortran] derived type with
|attribute not accepted |intent(in) attribute not
| |accepted
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/13930] [gfortran] derived type with intent(in) attribute not accepted
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
2004-01-30 12:41 ` [Bug fortran/13930] [gfortran] " pinskia at gcc dot gnu dot org
@ 2004-02-06 1:23 ` pinskia at gcc dot gnu dot org
2004-04-22 13:06 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-06 1:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-06 01:23 -------
Confirmed, NAG f95 accepts the code.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2004-02-06 01:23:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/13930] [gfortran] derived type with intent(in) attribute not accepted
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
2004-01-30 12:41 ` [Bug fortran/13930] [gfortran] " pinskia at gcc dot gnu dot org
2004-02-06 1:23 ` pinskia at gcc dot gnu dot org
@ 2004-04-22 13:06 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2004-05-17 4:37 ` tobi at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tobias dot Schlueter at physik dot uni-muenchen dot de @ 2004-04-22 13:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Tobias dot Schlueter at physik dot uni-muenchen dot de 2004-04-22 12:50 -------
This seems to be allowed by the standard: 5.1.2.3 of the Fortran 95 draft
standard only has the following restriction:
-------
A dummy argument with the INTENT(IN) attribute, ..., shall not appear as:
...
(10) An actual argument in a reference to a procedure with an explicit interface
when the associated dummy argument has the INTENT(OUT) or INTENT(INOUT) attribute
-------
Since external_f in the example has no explicit interface, the compiler must
assume that the user did the right thing.
Another problem is the badly placed error message.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/13930] [gfortran] derived type with intent(in) attribute not accepted
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
` (2 preceding siblings ...)
2004-04-22 13:06 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
@ 2004-05-17 4:37 ` tobi at gcc dot gnu dot org
2004-05-18 15:48 ` cvs-commit at gcc dot gnu dot org
2004-05-18 15:54 ` pbrook at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-05-17 4:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2004-05-16 19:29 -------
It's interesting that this bug only happens with a user-defined type as the type
of the function called. I missed this until I tried to further reduce the testcase.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/13930] [gfortran] derived type with intent(in) attribute not accepted
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
` (3 preceding siblings ...)
2004-05-17 4:37 ` tobi at gcc dot gnu dot org
@ 2004-05-18 15:48 ` cvs-commit at gcc dot gnu dot org
2004-05-18 15:54 ` pbrook at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-18 15:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-05-18 00:48 -------
Subject: Bug 13930
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pbrook@gcc.gnu.org 2004-05-18 00:48:05
Modified files:
gcc/fortran : ChangeLog decl.c expr.c gfortran.h resolve.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gfortran.fortran-torture/execute: der_init_4.f90
Log message:
PR fortran/13930
* decl.c (add_init_expr_to_sym): Remove incorrect check.
(default_initializer): Move to expr.c.
(variable_decl): Don't assign default initializer to variables.
* expr.c (gfc_default_initializer): Move to here.
* gfortran.h (gfc_default_initializer): Add prototype.
* resolve.c (resolve_symbol): Check for illegal initializers.
Assign default initializer.
testsuite/
* gfortran.fortran-torture/execute/der_init_4.f90: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.27&r2=1.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/decl.c.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/expr.c.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/gfortran.h.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3757&r2=1.3758
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/der_init_4.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/13930] [gfortran] derived type with intent(in) attribute not accepted
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
` (4 preceding siblings ...)
2004-05-18 15:48 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-18 15:54 ` pbrook at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2004-05-18 15:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pbrook at gcc dot gnu dot org 2004-05-18 00:48 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13930
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-05-18 0:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-30 11:37 [Bug fortran/13930] New: derived type with intent(in) attribute not accepted Mart dot Rentmeester at sci dot kun dot nl
2004-01-30 12:41 ` [Bug fortran/13930] [gfortran] " pinskia at gcc dot gnu dot org
2004-02-06 1:23 ` pinskia at gcc dot gnu dot org
2004-04-22 13:06 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2004-05-17 4:37 ` tobi at gcc dot gnu dot org
2004-05-18 15:48 ` cvs-commit at gcc dot gnu dot org
2004-05-18 15:54 ` pbrook at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).