Commit d59b1dcb by Daniel Franke Committed by Daniel Franke

re PR fortran/41940 (Improve error message for allocating scalar with shape)

gcc/fortran:
2009-12-07  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/41940
        * match.c (gfc_match_allocate): Improved error message for
        allocatable scalars that are allocated with a shape.

gcc/testsuite:
2009-12-07  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/41940
        * gfortran.dg/allocate_scalar_with_shape.f90: New.

From-SVN: r155049
parent b3a00b50
2009-12-07 Daniel Franke <franke.daniel@gmail.com>
PR fortran/41940
* match.c (gfc_match_allocate): Improved error message for
allocatable scalars that are allocated with a shape.
2009-12-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR other/40302
......
......@@ -2502,6 +2502,12 @@ gfc_match_allocate (void)
goto cleanup;
}
if (gfc_peek_ascii_char () == '(' && !sym->attr.dimension)
{
gfc_error ("Shape specification for allocatable scalar at %C");
goto cleanup;
}
if (gfc_match_char (',') != MATCH_YES)
break;
......
2009-12-07 Daniel Franke <franke.daniel@gmail.com>
PR fortran/41940
* gfortran.dg/allocate_scalar_with_shape.f90: New.
2009-12-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR other/40302
......
! { dg-do "compile" }
! PR fortran/41940
integer, allocatable :: a
TYPE :: x
integer, allocatable :: a
END TYPE
TYPE (x) :: y
allocate(a(4)) ! { dg-error "Shape specification for allocatable scalar" }
allocate(y%a(4)) ! { dg-error "Shape specification for allocatable scalar" }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment