Commit c20f6223 by Jerry DeLisle

re PR fortran/35849 ("wrong" line shown in error message for parameter)

2016-07-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/35849
	* simplify.c (gfc_simplify_ishftc): Check that absolute value of
	SHIFT is less than or equal to SIZE.

	* gfortran.dg: pr35849.f90: New test.

Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>

From-SVN: r237993
parent 2a5537c3
2016-07-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/35849
* simplify.c (gfc_simplify_ishftc): Check that absolute value of
SHIFT is less than or equal to SIZE.
2016-07-01 Jakub Jelinek <jakub@redhat.com>
PR fortran/71687
......
......@@ -3280,7 +3280,6 @@ gfc_simplify_ishftc (gfc_expr *e, gfc_expr *s, gfc_expr *sz)
return NULL;
gfc_extract_int (sz, &ssize);
}
else
ssize = isize;
......@@ -3294,7 +3293,10 @@ gfc_simplify_ishftc (gfc_expr *e, gfc_expr *s, gfc_expr *sz)
{
if (sz == NULL)
gfc_error ("Magnitude of second argument of ISHFTC exceeds "
"BIT_SIZE of first argument at %L", &s->where);
"BIT_SIZE of first argument at %C");
else
gfc_error ("Absolute value of SHIFT shall be less than or equal "
"to SIZE at %C");
return &gfc_bad_expr;
}
......
2016-07-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35849
* gfortran.dg: pr35849.f90: New test.
2016-07-04 Jakub Jelinek <jakub@redhat.com>
PR c++/71739
......
! { dg-do compile }
! PR35849
INTEGER, PARAMETER :: j = 15
INTEGER, PARAMETER, DIMENSION(10) :: A = [(i, i = 1,10)]
INTEGER, PARAMETER, DIMENSION(10) :: B = ISHFTC(j, A, -20) ! { dg-error "must be positive" }
INTEGER, PARAMETER, DIMENSION(10) :: C = ISHFTC(1_1, A, j) ! { dg-error "less than or equal to BIT_SIZE" }
INTEGER, PARAMETER, DIMENSION(10) :: D = ISHFTC(3, A, 5) ! { dg-error "Absolute value of SHIFT shall be less than or equal" }
INTEGER, PARAMETER, DIMENSION(10) :: E = ISHFTC(3_1, A) ! { dg-error "second argument of ISHFTC exceeds BIT_SIZE of first argument" }
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