mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 21:01:09 +08:00
re PR fortran/67615 (ICE on using arithmetic if with array instead of scalar)
2015-09-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67615 * resolve.c (gfc_resolve_code): Check for scalar expression in arithmetic-if. 2015-09-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67615 * gfortran.dg/pr67615.f90: new test. From-SVN: r227981
This commit is contained in:
parent
d7b00a16de
commit
e2eb0806ea
@ -1,3 +1,9 @@
|
||||
2015-09-21 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/67615
|
||||
* resolve.c (gfc_resolve_code): Check for scalar expression in
|
||||
arithmetic-if.
|
||||
|
||||
2015-09-17 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/52846
|
||||
|
@ -10377,15 +10377,18 @@ gfc_resolve_code (gfc_code *code, gfc_namespace *ns)
|
||||
}
|
||||
|
||||
case EXEC_ARITHMETIC_IF:
|
||||
if (t
|
||||
&& code->expr1->ts.type != BT_INTEGER
|
||||
&& code->expr1->ts.type != BT_REAL)
|
||||
gfc_error ("Arithmetic IF statement at %L requires a numeric "
|
||||
"expression", &code->expr1->where);
|
||||
{
|
||||
gfc_expr *e = code->expr1;
|
||||
|
||||
resolve_branch (code->label1, code);
|
||||
resolve_branch (code->label2, code);
|
||||
resolve_branch (code->label3, code);
|
||||
if (t && (e->rank > 0
|
||||
|| !(e->ts.type == BT_REAL || e->ts.type == BT_INTEGER)))
|
||||
gfc_error ("Arithmetic IF statement at %L requires a scalar "
|
||||
"REAL or INTEGER expression", &code->expr1->where);
|
||||
|
||||
resolve_branch (code->label1, code);
|
||||
resolve_branch (code->label2, code);
|
||||
resolve_branch (code->label3, code);
|
||||
}
|
||||
break;
|
||||
|
||||
case EXEC_IF:
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-09-21 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/67615
|
||||
* gfortran.dg/pr67615.f90: new test.
|
||||
|
||||
2015-09-21 Jeff Law <law@redhat.com>
|
||||
|
||||
* gcc.target/h8300/andsi3_ashift_n_lower.c: New test.
|
||||
|
33
gcc/testsuite/gfortran.dg/pr67615.f90
Normal file
33
gcc/testsuite/gfortran.dg/pr67615.f90
Normal file
@ -0,0 +1,33 @@
|
||||
! { dg-do compile }
|
||||
! { dg-options "-std=legacy" }
|
||||
! PR fortran/67615
|
||||
!
|
||||
program foo
|
||||
|
||||
implicit none
|
||||
|
||||
integer i(2), j
|
||||
real x
|
||||
complex z
|
||||
|
||||
j = 2
|
||||
if (j) 10, 20, 30
|
||||
|
||||
x = -1
|
||||
if (x) 10, 20, 30
|
||||
|
||||
z = (1,2)
|
||||
if (z) 10, 20, 30 ! { dg-error "Arithmetic IF statement" }
|
||||
|
||||
i = [1, 2]
|
||||
if (i) 10, 20, 30 ! { dg-error "Arithmetic IF statement" }
|
||||
|
||||
if ( [1] ) 10, 20, 30 ! { dg-error "Arithmetic IF statement" }
|
||||
if ( [1, -1] ) 10, 20, 30 ! { dg-error "Arithmetic IF statement" }
|
||||
if ( [real :: 1, -1] ) 10, 20, 30 ! { dg-error "Arithmetic IF statement" }
|
||||
|
||||
10 stop
|
||||
20 stop
|
||||
30 stop
|
||||
|
||||
end program foo
|
Loading…
x
Reference in New Issue
Block a user