gcc/libgfortran/intrinsics
Tobias Burnus 786503593c Fortran: Fix assumed-size to assumed-rank passing [PR94070]
This code inlines the size0 and size1 libgfortran calls, the former is still
used by libgfortan itself (and by old code). Besides permitting more
optimizations, it also permits to handle assumed-rank dummies better: If the
dummy argument is a nonpointer/nonallocatable, an assumed-size actual arg is
repesented by having ubound == -1 for the last dimension. However, for
allocatable/pointers, this value can also exist. Hence, the dummy arg attr
has to be honored.

For that reason, when calling an assumed-rank procedure with nonpointer,
nonallocatable dummy arguments, the bounds have to be updated to avoid
the case ubound == -1 for the last dimension.

	PR fortran/94070

gcc/fortran/ChangeLog:

	* trans-array.c (gfc_tree_array_size): New function to
	find size inline (whole array or one dimension).
	(array_parameter_size): Use it, take stmt_block as arg.
	(gfc_conv_array_parameter): Update call.
	* trans-array.h (gfc_tree_array_size): Add prototype.
	* trans-decl.c (gfor_fndecl_size0, gfor_fndecl_size1): Remove
	these global vars.
	(gfc_build_intrinsic_function_decls): Remove their initialization.
	* trans-expr.c (gfc_conv_procedure_call): Update
	bounds of pointer/allocatable actual args to nonallocatable/nonpointer
	dummies to be one based.
	* trans-intrinsic.c (gfc_conv_intrinsic_shape): Fix case for
	assumed rank with allocatable/pointer dummy.
	(gfc_conv_intrinsic_size): Update to use inline function.
	* trans.h (gfor_fndecl_size0, gfor_fndecl_size1): Remove var decl.

libgfortran/ChangeLog:

	* intrinsics/size.c (size0, size1): Comment that now not
	used by newer compiler code.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Update
	expected dg-note output.

gcc/testsuite/ChangeLog:

	* gfortran.dg/c-interop/cf-out-descriptor-6.f90: Remove xfail.
	* gfortran.dg/c-interop/size.f90: Remove xfail.
	* gfortran.dg/intrinsic_size_3.f90: Update scan-tree-dump-times.
	* gfortran.dg/transpose_optimization_2.f90: Likewise.
	* gfortran.dg/size_optional_dim_1.f90: Add scan-tree-dump-not.
	* gfortran.dg/assumed_rank_22.f90: New test.
	* gfortran.dg/assumed_rank_22_aux.c: New test.

(cherry picked from commit 00f6de9c69)
2021-09-27 14:47:27 +02:00
..
abort.c Update copyright years. 2021-01-04 10:26:59 +01:00
access.c Update copyright years. 2021-01-04 10:26:59 +01:00
args.c Update copyright years. 2021-01-04 10:26:59 +01:00
associated.c Fortran: Fix associated intrinsic with assumed rank [PR101334] 2021-09-26 19:30:31 +02:00
c99_functions.c Update copyright years. 2021-01-04 10:26:59 +01:00
chdir.c Update copyright years. 2021-01-04 10:26:59 +01:00
chmod.c Update copyright years. 2021-01-04 10:26:59 +01:00
clock.c Update copyright years. 2021-01-04 10:26:59 +01:00
cpu_time.c Update copyright years. 2021-01-04 10:26:59 +01:00
cshift0.c Update copyright years. 2021-01-04 10:26:59 +01:00
ctime.c Update copyright years. 2021-01-04 10:26:59 +01:00
date_and_time.c Update copyright years. 2021-01-04 10:26:59 +01:00
dprod_r8.f90 Update copyright years. 2021-01-04 10:26:59 +01:00
dtime.c Update copyright years. 2021-01-04 10:26:59 +01:00
env.c Update copyright years. 2021-01-04 10:26:59 +01:00
eoshift0.c Update copyright years. 2021-01-04 10:26:59 +01:00
eoshift2.c Update copyright years. 2021-01-04 10:26:59 +01:00
erfc_scaled_inc.c Update copyright years. 2021-01-04 10:26:59 +01:00
erfc_scaled.c Update copyright years. 2021-01-04 10:26:59 +01:00
etime.c Update copyright years. 2021-01-04 10:26:59 +01:00
execute_command_line.c Update copyright years. 2021-01-04 10:26:59 +01:00
exit.c Update copyright years. 2021-01-04 10:26:59 +01:00
extends_type_of.c Update copyright years. 2021-01-04 10:26:59 +01:00
f2c_specifics.F90 Update copyright years. 2021-01-04 10:26:59 +01:00
fnum.c Update copyright years. 2021-01-04 10:26:59 +01:00
gerror.c Update copyright years. 2021-01-04 10:26:59 +01:00
getcwd.c Update copyright years. 2021-01-04 10:26:59 +01:00
getlog.c Update copyright years. 2021-01-04 10:26:59 +01:00
getXid.c Update copyright years. 2021-01-04 10:26:59 +01:00
hostnm.c Update copyright years. 2021-01-04 10:26:59 +01:00
ierrno.c Update copyright years. 2021-01-04 10:26:59 +01:00
is_contiguous.c Update copyright years. 2021-01-04 10:26:59 +01:00
ishftc.c Update copyright years. 2021-01-04 10:26:59 +01:00
kill.c Update copyright years. 2021-01-04 10:26:59 +01:00
link.c Update copyright years. 2021-01-04 10:26:59 +01:00
move_alloc.c Update copyright years. 2021-01-04 10:26:59 +01:00
mvbits.c Update copyright years. 2021-01-04 10:26:59 +01:00
pack_generic.c Update copyright years. 2021-01-04 10:26:59 +01:00
perror.c Update copyright years. 2021-01-04 10:26:59 +01:00
rand.c Update copyright years. 2021-01-04 10:26:59 +01:00
random_init.f90 PR fortran/98301 - random_init() is broken 2021-06-06 12:07:01 +02:00
random.c Update copyright years. 2021-01-04 10:26:59 +01:00
rename.c Update copyright years. 2021-01-04 10:26:59 +01:00
reshape_generic.c Update copyright years. 2021-01-04 10:26:59 +01:00
reshape_packed.c Update copyright years. 2021-01-04 10:26:59 +01:00
selected_char_kind.c Update copyright years. 2021-01-04 10:26:59 +01:00
selected_int_kind.f90 Update copyright years. 2021-01-04 10:26:59 +01:00
selected_real_kind.f90 Update copyright years. 2021-01-04 10:26:59 +01:00
signal.c Update copyright years. 2021-01-04 10:26:59 +01:00
size.c Fortran: Fix assumed-size to assumed-rank passing [PR94070] 2021-09-27 14:47:27 +02:00
sleep.c Update copyright years. 2021-01-04 10:26:59 +01:00
spread_generic.c Update copyright years. 2021-01-04 10:26:59 +01:00
stat.c Update copyright years. 2021-01-04 10:26:59 +01:00
string_intrinsics_inc.c Update copyright years. 2021-01-04 10:26:59 +01:00
string_intrinsics.c Update copyright years. 2021-01-04 10:26:59 +01:00
symlnk.c Update copyright years. 2021-01-04 10:26:59 +01:00
system_clock.c Update copyright years. 2021-01-04 10:26:59 +01:00
system.c Update copyright years. 2021-01-04 10:26:59 +01:00
time_1.h Update copyright years. 2021-01-04 10:26:59 +01:00
time.c Update copyright years. 2021-01-04 10:26:59 +01:00
trigd_lib.inc Update copyright years. 2021-01-04 10:26:59 +01:00
trigd.c Update copyright years. 2021-01-04 10:26:59 +01:00
trigd.inc Update copyright years. 2021-01-04 10:26:59 +01:00
umask.c Update copyright years. 2021-01-04 10:26:59 +01:00
unlink.c Update copyright years. 2021-01-04 10:26:59 +01:00
unpack_generic.c Update copyright years. 2021-01-04 10:26:59 +01:00