This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34683] Fortran FE generated IL pessimizes middle-end IL and analysis
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jan 2008 11:46:07 -0000
- Subject: [Bug fortran/34683] Fortran FE generated IL pessimizes middle-end IL and analysis
- References: <bug-34683-14773@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #14 from rguenth at gcc dot gnu dot org 2008-01-06 11:46 -------
As of optimization, the conversion sequence
atmp.0.data = &A.1;
D.540_5 = atmp.0.data;
D.541_6 = (real(kind=4)[0:] *) D.540_5;
...
(*D.541_6)[S.5_1] = D.545_14;
can be optimized to
A.1[S.5_1] = D.545_14;
with the following patch that makes sure we use (real(kind=4)[4] *) instead
of the unknown size array type.
Index: trans-types.c
===================================================================
--- trans-types.c (revision 131336)
+++ trans-types.c (working copy)
@@ -1511,10 +1511,12 @@ gfc_get_array_type_bounds (tree etype, i
/* TODO: known offsets for descriptors. */
GFC_TYPE_ARRAY_OFFSET (fat_type) = NULL_TREE;
- /* We define data as an unknown size array. Much better than doing
+ /* We define data as an array with the correct size. Much better than doing
pointer arithmetic. */
arraytype =
- build_array_type (etype, gfc_array_range_type);
+ build_array_type (etype, build_range_type (gfc_array_index_type,
+ gfc_index_zero_node, int_const_binop (MINUS_EXPR, stride,
+ integer_one_node, 0)));
arraytype = build_pointer_type (arraytype);
GFC_TYPE_ARRAY_DATAPTR_TYPE (fat_type) = arraytype;
(the patch needs to be adjusted for the cases stride is not the actual array
size, but you should get the idea)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34683