mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 14:15:30 +08:00
re PR fortran/31251 (Non-integer character length leads to segfault)
2007-05-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/31251 * decl.c (match_char_spec): Add check for invalid character lengths. 2007-05-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/31251 * gfortran.dg/char_type_len_2.f90: New test. From-SVN: r124469
This commit is contained in:
parent
a758fa89b5
commit
16f8ffc831
@ -1,3 +1,8 @@
|
||||
2007-05-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR fortran/31251
|
||||
* decl.c (match_char_spec): Add check for invalid character lengths.
|
||||
|
||||
2007-05-04 Brooks Moses <brooks.moses@codesourcery.com>
|
||||
|
||||
* intrinsic.texi (CMPLX): Document result kind.
|
||||
|
@ -1626,14 +1626,23 @@ rparen:
|
||||
syntax:
|
||||
gfc_error ("Syntax error in CHARACTER declaration at %C");
|
||||
m = MATCH_ERROR;
|
||||
gfc_free_expr (len);
|
||||
return m;
|
||||
|
||||
done:
|
||||
if (m == MATCH_YES && gfc_validate_kind (BT_CHARACTER, kind, true) < 0)
|
||||
if (gfc_validate_kind (BT_CHARACTER, kind, true) < 0)
|
||||
{
|
||||
gfc_error ("Kind %d is not a CHARACTER kind at %C", kind);
|
||||
m = MATCH_ERROR;
|
||||
}
|
||||
|
||||
if (seen_length == 1 && len != NULL
|
||||
&& len->ts.type != BT_INTEGER && len->ts.type != BT_UNKNOWN)
|
||||
{
|
||||
gfc_error ("Expression at %C must be of INTEGER type");
|
||||
m = MATCH_ERROR;
|
||||
}
|
||||
|
||||
if (m != MATCH_YES)
|
||||
{
|
||||
gfc_free_expr (len);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-05-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR fortran/31251
|
||||
* gfortran.dg/char_type_len_2.f90: New test.
|
||||
|
||||
2007-05-05 Geoffrey Keating <geoffk@apple.com>
|
||||
|
||||
PR 31775
|
||||
|
8
gcc/testsuite/gfortran.dg/char_type_len_2.f90
Normal file
8
gcc/testsuite/gfortran.dg/char_type_len_2.f90
Normal file
@ -0,0 +1,8 @@
|
||||
! { dg-do compile }
|
||||
! PR31251 Non-integer character length leads to segfault
|
||||
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
character(len=2.3) :: s ! { dg-error "must be of INTEGER type" }
|
||||
character(kind=1,len=4.3) : t ! { dg-error "must be of INTEGER type" }
|
||||
character(len=,,7.2,kind=1) : u ! { dg-error "Syntax error in CHARACTER declaration" }
|
||||
character(len=7,kind=2) : v ! ! { dg-error "Kind 2 is not a CHARACTER kind" }
|
||||
end
|
Loading…
Reference in New Issue
Block a user