mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 06:54:29 +08:00
re PR fortran/36746 (Rejects variable which is implictly typed as derived typed with DIMENSION)
2008-09-05 Daniel Kraft <d@domob.eu> PR fortran/36746 * primary.c (gfc_match_rvalue): Removed logic to handle implicit typing to a derived-type if a component reference is found. (gfc_match_varspec): Moved it here. 2008-09-05 Daniel Kraft <d@domob.eu> PR fortran/36746 * gfortran.dg/implicit_derived_type_1.f90: New test. * gfortran.dg/used_before_typed_5.f90: New test. From-SVN: r140034
This commit is contained in:
parent
719bb4e3d3
commit
ebac6d9cb9
@ -1,3 +1,10 @@
|
||||
2008-09-05 Daniel Kraft <d@domob.eu>
|
||||
|
||||
PR fortran/36746
|
||||
* primary.c (gfc_match_rvalue): Removed logic to handle implicit
|
||||
typing to a derived-type if a component reference is found.
|
||||
(gfc_match_varspec): Moved it here.
|
||||
|
||||
2008-09-04 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* trans-array.c (gfc_conv_array_parameter): Use correct types
|
||||
|
@ -1745,6 +1745,10 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
|
||||
if (equiv_flag)
|
||||
return MATCH_YES;
|
||||
|
||||
if (sym->ts.type == BT_UNKNOWN && gfc_peek_ascii_char () == '%'
|
||||
&& gfc_get_default_type (sym, sym->ns)->type == BT_DERIVED)
|
||||
gfc_set_default_type (sym, 0, sym->ns);
|
||||
|
||||
if (sym->ts.type != BT_DERIVED || gfc_match_char ('%') != MATCH_YES)
|
||||
goto check_substring;
|
||||
|
||||
@ -2434,10 +2438,6 @@ gfc_match_rvalue (gfc_expr **result)
|
||||
{
|
||||
case FL_VARIABLE:
|
||||
variable:
|
||||
if (sym->ts.type == BT_UNKNOWN && gfc_peek_ascii_char () == '%'
|
||||
&& gfc_get_default_type (sym, sym->ns)->type == BT_DERIVED)
|
||||
gfc_set_default_type (sym, 0, sym->ns);
|
||||
|
||||
e = gfc_get_expr ();
|
||||
|
||||
e->expr_type = EXPR_VARIABLE;
|
||||
|
@ -1,3 +1,9 @@
|
||||
2008-09-05 Daniel Kraft <d@domob.eu>
|
||||
|
||||
PR fortran/36746
|
||||
* gfortran.dg/implicit_derived_type_1.f90: New test.
|
||||
* gfortran.dg/used_before_typed_5.f90: New test.
|
||||
|
||||
2008-09-04 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* gcc.target/i386/cold-attribute-1.c: Update testcase.
|
||||
|
20
gcc/testsuite/gfortran.dg/implicit_derived_type_1.f90
Normal file
20
gcc/testsuite/gfortran.dg/implicit_derived_type_1.f90
Normal file
@ -0,0 +1,20 @@
|
||||
! { dg-do compile }
|
||||
|
||||
! PR fortran/36746
|
||||
! Check that parsing of component references for symbols with IMPLICIT
|
||||
! derived-type works.
|
||||
|
||||
! Reduced test from the PR.
|
||||
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
|
||||
|
||||
module m
|
||||
type t
|
||||
integer :: i
|
||||
end type t
|
||||
contains
|
||||
subroutine s(x)
|
||||
implicit type(t)(x)
|
||||
dimension x(:)
|
||||
print *, x(1)%i
|
||||
end subroutine s
|
||||
end module m
|
19
gcc/testsuite/gfortran.dg/used_before_typed_5.f90
Normal file
19
gcc/testsuite/gfortran.dg/used_before_typed_5.f90
Normal file
@ -0,0 +1,19 @@
|
||||
! { dg-do compile }
|
||||
! { dg-options "-pedantic -std=f95" }
|
||||
|
||||
! Check that DIMENSION/POINTER/ALLOCATABLE/INTENT statements *do* allow
|
||||
! symbols to be typed later.
|
||||
|
||||
SUBROUTINE test (a)
|
||||
IMPLICIT REAL (a-z)
|
||||
|
||||
! Those should *not* IMPLICIT-type the symbols:
|
||||
INTENT(IN) :: a
|
||||
DIMENSION :: b(:)
|
||||
POINTER :: c
|
||||
ALLOCATABLE :: b
|
||||
|
||||
! So this is ok:
|
||||
INTEGER :: a, b, c
|
||||
|
||||
END SUBROUTINE test
|
Loading…
Reference in New Issue
Block a user