[fortran] Re: Make array_at_struct_end_p to grok MEM_REFs
Richard Biener
rguenther@suse.de
Tue May 24 13:58:00 GMT 2016
On Tue, 24 May 2016, Jan Hubicka wrote:
> Hi,
> I tried the attached patch that gets rid of gfc_array_range_type because it
> seems pointless from middle-end POV. It however affects .original dumps in the
> following way:
> --- assumed_type_2.f90.003t.original 2016-05-24 14:32:45.771503552 +0200
> +++ ../assumed_type_2.f90.003t.original 2016-05-24 14:34:07.637311579 +0200
> @@ -246,7 +246,7 @@
> parm.20.offset = NON_LVALUE_EXPR <D.3501>;
> D.3504 = _gfortran_internal_pack (&parm.20);
> sub_array_assumed (D.3504);
> - if ((void *[0:] *) parm.20.data != (void *[0:] *) D.3504)
> + if ((void *[<unknown>] *) parm.20.data != (void *[<unknown>] *) D.3504)
> {
> _gfortran_internal_unpack (&parm.20, D.3504);
> __builtin_free (D.3504);
> @@ -576,12 +576,12 @@
> {
> static logical(kind=4) C.3584 = 1;
>
> - sub_scalar (&(*(real(kind=4)[0:] * restrict) array_real_alloc.data)[(array_real_alloc.offset + array_real_alloc.dim[1].stride * 2) + 3], &C.3584);
> + sub_scalar (&(*(real(kind=4)[<unknown>] * restrict) array_real_alloc.data)[(array_real_alloc.offset + array_real_alloc.dim[1].stride * 2) + 3], &C.3584);
> }
> {
> static logical(kind=4) C.3585 = 1;
>
> - sub_scalar (&(*(character(kind=1)[0:][1:1] *) array_char_ptr.data)[array_char_ptr.offset + NON_LVALUE_EXPR <array_char_ptr.dim[1].stride>], &C.3585, 1);
> + sub_scalar (&(*(character(kind=1)[<unknown>][1:1] *) array_char_ptr.data)[array_char_ptr.offset + NON_LVALUE_EXPR <array_char_ptr.dim[1].stride>], &C.3585, 1);
> }
> {
> static logical(kind=4) C.3586 = 1;
>
> Which breaks testsuite. Perhaps just
> <unknown> can be printed as 0: (because that is what NULL domain means). This
> is done by dump_array_domain in pretty-print.c and I am not quite sure who
> else relies on the format.
> Or we can just compoensate the testsuite given that the bounds are really
> unknown...
As said I'd simply use NULL TYPE_MAX_VALUE, not drop TYPE_DOMAIN
completely (yes, NULL TYPE_DOMAIN is equal to [0:] so we can as well
print that - as you say, not sure what else breaks with that ;))
Richard.
> Honza
>
> Index: trans-types.c
> ===================================================================
> --- trans-types.c (revision 236556)
> +++ trans-types.c (working copy)
> @@ -52,7 +52,6 @@ along with GCC; see the file COPYING3.
> CInteropKind_t c_interop_kinds_table[ISOCBINDING_NUMBER];
>
> tree gfc_array_index_type;
> -tree gfc_array_range_type;
> tree gfc_character1_type_node;
> tree pvoid_type_node;
> tree prvoid_type_node;
> @@ -945,12 +944,6 @@ gfc_init_types (void)
> = build_pointer_type (build_function_type_list (void_type_node, NULL_TREE));
>
> gfc_array_index_type = gfc_get_int_type (gfc_index_integer_kind);
> - /* We cannot use gfc_index_zero_node in definition of gfc_array_range_type,
> - since this function is called before gfc_init_constants. */
> - gfc_array_range_type
> - = build_range_type (gfc_array_index_type,
> - build_int_cst (gfc_array_index_type, 0),
> - NULL_TREE);
>
> /* The maximum array element size that can be handled is determined
> by the number of bits available to store this field in the array
> @@ -1920,12 +1913,12 @@ gfc_get_array_type_bounds (tree etype, i
>
> /* We define data as an array with the correct size if possible.
> Much better than doing pointer arithmetic. */
> - if (stride)
> + if (stride && akind >= GFC_ARRAY_UNKNOWN)
> rtype = build_range_type (gfc_array_index_type, gfc_index_zero_node,
> int_const_binop (MINUS_EXPR, stride,
> build_int_cst (TREE_TYPE (stride), 1)));
> else
> - rtype = gfc_array_range_type;
> + rtype = NULL;
> arraytype = build_array_type (etype, rtype);
> arraytype = build_pointer_type (arraytype);
> if (restricted)
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
More information about the Gcc-patches
mailing list