Commit 51df93ba by Paul Thomas

re PR fortran/38763 (TRANSFER ICE due to missing EXPR_NULL case)

2009-01-10  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/38763
	* target-memory.c (encode_derived): Encode NULL.

2009-01-10  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/38763
	* gfortran.dg/transfer_null_1.f90: New test.

From-SVN: r143238
parent 9be3684b
2009-01-10 Paul Thomas <pault@gcc.gnu.org> 2009-01-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38763
* target-memory.c (encode_derived): Encode NULL.
2009-01-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38765 PR fortran/38765
* resolve.c (check_host_association): Use the symtree name to * resolve.c (check_host_association): Use the symtree name to
search for a potential contained procedure, since this is the search for a potential contained procedure, since this is the
......
/* Simulate storage of variables into target memory. /* Simulate storage of variables into target memory.
Copyright (C) 2007, 2008 Copyright (C) 2007, 2008, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Paul Thomas and Brooks Moses Contributed by Paul Thomas and Brooks Moses
...@@ -220,8 +220,13 @@ encode_derived (gfc_expr *source, unsigned char *buffer, size_t buffer_size) ...@@ -220,8 +220,13 @@ encode_derived (gfc_expr *source, unsigned char *buffer, size_t buffer_size)
continue; continue;
ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl)) ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl))
+ TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8; + TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8;
gfc_target_encode_expr (ctr->expr, &buffer[ptr],
buffer_size - ptr); if (ctr->expr->expr_type == EXPR_NULL)
memset (&buffer[ptr], 0,
int_size_in_bytes (TREE_TYPE (cmp->backend_decl)));
else
gfc_target_encode_expr (ctr->expr, &buffer[ptr],
buffer_size - ptr);
} }
return int_size_in_bytes (type); return int_size_in_bytes (type);
......
2009-01-10 Paul Thomas <pault@gcc.gnu.org> 2009-01-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38763
* gfortran.dg/transfer_null_1.f90: New test.
2009-01-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38765 PR fortran/38765
* gfortran.dg/host_assoc_function_6.f90: New test. * gfortran.dg/host_assoc_function_6.f90: New test.
......
! { dg-do compile }
! Test fix for pr38763, where NULL was not being encoded.
!
! Contributed by Steve Kargl <kargl@gcc.gnu.org> from a
! posting by James van Buskirk on clf.
!
program sizetest
use ISO_C_BINDING
implicit none
integer, parameter :: ik1 = selected_int_kind(2)
TYPE vehicle_t1
INTEGER(C_INT), DIMENSION(:), ALLOCATABLE :: sensors
END TYPE vehicle_t1
type(vehicle_t1) gfortran_bug_workaround
integer i
i = size(transfer(vehicle_t1(NULL()),[0_ik1]))
print *, i
i = size(transfer(vehicle_t1([i]),[0_ik1]))
print *, i
end program sizetest
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