diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-06-08 19:11:21 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-06-08 19:11:21 +0000 |
commit | 2f2fc3252c04fbd51de8d0ff95bb85e2049f0887 (patch) | |
tree | 1bcc3e02bc3628d9a177e34a3a38fce7f3adbab0 /gcc | |
parent | 5954faa7c22d550ec57e9a40e5a738630be07b0f (diff) | |
download | gcc-2f2fc3252c04fbd51de8d0ff95bb85e2049f0887.zip gcc-2f2fc3252c04fbd51de8d0ff95bb85e2049f0887.tar.gz gcc-2f2fc3252c04fbd51de8d0ff95bb85e2049f0887.tar.bz2 |
re PR fortran/86059 (ICE in reduce_binary_ac, at fortran/arith.c:1308 (and others))
2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/86059
* array.c (match_array_cons_element): NULL() cannot be in an
array constructor.
2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/86059
* gfortran.dg/associate_30.f90: Remove code tested ...
* gfortran.dg/pr67803.f90: Ditto.
* gfortran.dg/pr67805.f90: Ditto.
* gfortran.dg/pr86059.f90: ... here. New test.
From-SVN: r261344
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/array.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/associate_30.f90 | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr67803.f90 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr67805.f90 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr86059.f90 | 8 |
7 files changed, 31 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b48f11c..dffc7f4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org> + PR fortran/86059 + * array.c (match_array_cons_element): NULL() cannot be in an + array constructor. + +2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org> + PR fortran/78571 * data.c (create_character_initializer): Return early if type is incompatible with CHARACTER. diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 36b809e..031ab76 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1098,6 +1098,15 @@ match_array_cons_element (gfc_constructor_base *result) if (m != MATCH_YES) return m; + if (expr->expr_type == EXPR_FUNCTION + && expr->ts.type == BT_UNKNOWN + && strcmp(expr->symtree->name, "null") == 0) + { + gfc_error ("NULL() at %C cannot appear in an array constructor"); + gfc_free_expr (expr); + return MATCH_ERROR; + } + gfc_constructor_append_expr (result, expr, &gfc_current_locus); return MATCH_YES; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4d18b3..682c67b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org> + PR fortran/86059 + * gfortran.dg/associate_30.f90: Remove code tested ... + * gfortran.dg/pr67803.f90: Ditto. + * gfortran.dg/pr67805.f90: Ditto. + * gfortran.dg/pr86059.f90: ... here. New test. + +2018-06-08 Steven G. Kargl <kargl@gcc.gnu.org> + PR fortran/78571 * gfortran.dg/pr78571.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/associate_30.f90 b/gcc/testsuite/gfortran.dg/associate_30.f90 index ad15d8b..ecc9ad0 100644 --- a/gcc/testsuite/gfortran.dg/associate_30.f90 +++ b/gcc/testsuite/gfortran.dg/associate_30.f90 @@ -8,8 +8,3 @@ associate (x => null()) ! { dg-error "cannot be NULL()" } end associate end subroutine - - subroutine s2 - associate (x => [null()]) ! { dg-error "has no type" } - end associate - end subroutine diff --git a/gcc/testsuite/gfortran.dg/pr67803.f90 b/gcc/testsuite/gfortran.dg/pr67803.f90 index 9a8ff30..55a1bbf 100644 --- a/gcc/testsuite/gfortran.dg/pr67803.f90 +++ b/gcc/testsuite/gfortran.dg/pr67803.f90 @@ -10,5 +10,4 @@ program p x = '0' // [character :: 1d1] ! { dg-error "Incompatible typespec for" } x = '0' // [character :: (0.,1.)] ! { dg-error "Incompatible typespec for" } x = '0' // [character :: .true.] ! { dg-error "Incompatible typespec for" } - x = '0' // [character :: null()] ! { dg-error "Incompatible typespec for" } end diff --git a/gcc/testsuite/gfortran.dg/pr67805.f90 b/gcc/testsuite/gfortran.dg/pr67805.f90 index 7371991..2aedde8 100644 --- a/gcc/testsuite/gfortran.dg/pr67805.f90 +++ b/gcc/testsuite/gfortran.dg/pr67805.f90 @@ -22,7 +22,6 @@ subroutine p s = [character([1.]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } s = [character([1d1]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } s = [character([(0.,1.)]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } - s = [character([null()]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } s = [character(null()) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } call foo(s) end subroutine p diff --git a/gcc/testsuite/gfortran.dg/pr86059.f90 b/gcc/testsuite/gfortran.dg/pr86059.f90 new file mode 100644 index 0000000..e0caed1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr86059.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/86059 +program foo + integer :: i(2) = [ null(), 1 ] ! { dg-error "cannot appear in an array constructor" } + integer :: j(2) = [ (null(), n = 1, 2) ] ! { dg-error "cannot appear in an array constructor" } + integer k(2) + k = 42 + [1, null()] ! { dg-error "cannot appear in an array constructor" } +end program foo |