Commit d52d3767 by Steven G. Kargl

re PR fortran/71935 (ICE is_c_interoperable(): gfc_simplify_expr failed)

2016-07-22  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/71935
	* check.c (is_c_interoperable): Simplify right expression. 

2016-07-22  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/71935
	* gfortran.dg/c_sizeof_1.f90: Move invalid code to ...
	* gfortran.dg/c_sizeof_6.f90: here.  Test for error.
	* gfortran.dg/pr71935.f90: New test.

From-SVN: r238665
parent 2e6b45af
2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71935
* check.c (is_c_interoperable): Simplify right expression.
2016-07-22 Thomas Koenig <tkoenig@gcc.gnu.org> 2016-07-22 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71795 PR fortran/71795
......
...@@ -4278,7 +4278,7 @@ is_c_interoperable (gfc_expr *expr, const char **msg, bool c_loc, bool c_f_ptr) ...@@ -4278,7 +4278,7 @@ is_c_interoperable (gfc_expr *expr, const char **msg, bool c_loc, bool c_f_ptr)
} }
if (expr->ts.u.cl && expr->ts.u.cl->length if (expr->ts.u.cl && expr->ts.u.cl->length
&& !gfc_simplify_expr (expr, 0)) && !gfc_simplify_expr (expr->ts.u.cl->length, 0))
gfc_internal_error ("is_c_interoperable(): gfc_simplify_expr failed"); gfc_internal_error ("is_c_interoperable(): gfc_simplify_expr failed");
if (!c_loc && expr->ts.u.cl if (!c_loc && expr->ts.u.cl
......
2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71935
* gfortran.dg/c_sizeof_1.f90: Move invalid code to ...
* gfortran.dg/c_sizeof_6.f90: here. Test for error.
* gfortran.dg/pr71935.f90: New test.
2016-07-22 Martin Sebor <msebor@redhat.com> 2016-07-22 Martin Sebor <msebor@redhat.com>
PR c++/71675 PR c++/71675
......
...@@ -22,9 +22,6 @@ if (i /= 4) call abort() ...@@ -22,9 +22,6 @@ if (i /= 4) call abort()
i = c_sizeof(str2(1)) i = c_sizeof(str2(1))
if (i /= 1) call abort() if (i /= 1) call abort()
i = c_sizeof(str2(1:3))
if (i /= 3) call abort()
write(*,*) c_sizeof(cptr), c_sizeof(iptr), c_sizeof(C_NULL_PTR) write(*,*) c_sizeof(cptr), c_sizeof(iptr), c_sizeof(C_NULL_PTR)
! Using GNU's SIZEOF ! Using GNU's SIZEOF
......
! { dg-do compile }
!
program foo
use iso_c_binding, only: c_int, c_char, c_sizeof
integer(kind=c_int) :: i
character(kind=c_char,len=1),parameter :: str2(4) = ["a","b","c","d"]
i = c_sizeof(str2(1:3)) ! { dg-error "must be an interoperable data" }
if (i /= 3) call abort()
end program foo
! { dg-do compile }
program p
use iso_c_binding
character(len=1, kind=c_char), parameter :: z(2) = 'z'
print *, sizeof(z(3)) ! { dg-warning "is out of bounds" }
print *, c_sizeof(z(3)) ! { dg-warning "is out of bounds" }
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