diff options
author | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-02-18 12:23:20 +0000 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-02-18 12:23:20 +0000 |
commit | 8f55a0eec910dd02992f4caca083048d91c0b2e1 (patch) | |
tree | e8bcd79b1f67c14dcd1fff84144bac2a672d359a | |
parent | d4c10c9f4bff616e7ed07e92504fe31a700e2af1 (diff) | |
download | gcc-8f55a0eec910dd02992f4caca083048d91c0b2e1.zip gcc-8f55a0eec910dd02992f4caca083048d91c0b2e1.tar.gz gcc-8f55a0eec910dd02992f4caca083048d91c0b2e1.tar.bz2 |
[Fortran] ICE in gfc_typenode_for_spec PR93603
Associating a symbol with a BOZ constant caused an ICE. Output
an error message as an association target cannot be a BOZ
constant.
Original patch provided by Steven G. Kargl <kargl@gcc.gnu.org>.
gcc/fortran/ChangeLog
PR fortran/93603
* match.c (gfc_match_associate) : If target expression
has the type BT_BOZ output an error and goto
assocListError.
gcc/testsuite/ChangeLog
PR fortran/93603
* gfortran.dg/pr93603.f90 : New test.
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/match.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr93603.f90 | 7 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 302af3a..2e874b8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,11 @@ 2020-02-18 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/93603 + * match.c (gfc_match_associate) : If target expression + has the type BT_BOZ output an error and goto + assocListError. + +2020-02-18 Steven G. Kargl <kargl@gcc.gnu.org> Mark Eggleston <markeggleston@gcc.gnu.org> PR fortran/93580 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index a74cb8c..9c2ec41 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1957,6 +1957,14 @@ gfc_match_associate (void) goto assocListError; } + /* The target expression cannot be a BOZ literal constant. */ + if (newAssoc->target->ts.type == BT_BOZ) + { + gfc_error ("Association target at %L cannot be a BOZ literal " + "constant", &newAssoc->target->where); + goto assocListError; + } + /* The `variable' field is left blank for now; because the target is not yet resolved, we can't use gfc_has_vector_subscript to determine it for now. This is set during resolution. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c7f879..f9a545e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-02-18 Mark Eggleston <mark.eggleston@codethink.com> + + PR fortran/93603 + * gfortran.dg/pr93603.f90 : New test. + 2020-02-20 Mark Eggleston <markeggleston@gcc.gnu.org> PR fortran/93580 diff --git a/gcc/testsuite/gfortran.dg/pr93603.f90 b/gcc/testsuite/gfortran.dg/pr93603.f90 new file mode 100644 index 0000000..fd452e5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr93603.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } + +program p + associate (y => z'1') ! { dg-error "cannot be a BOZ literal constant" } + end associate ! { dg-error "Expecting END PROGRAM" } +end + |