summaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-27 11:57:01 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-27 11:57:01 +0000
commit8560c588b8e703a936e09b8b1c5381289b6fe2a8 (patch)
tree6551aaedcd3c7893355d5933f81fbb2dce9863de /gcc/fortran/simplify.c
parentc3986c7ab5d242067928f202cc5f7c661242ce2a (diff)
downloadgcc-8560c588b8e703a936e09b8b1c5381289b6fe2a8.tar.gz
2010-09-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 164647 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@164648 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index a7b678f406a..8748ecfba8b 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "intrinsic.h"
#include "target-memory.h"
#include "constructor.h"
+#include "version.h" /* For version_string. */
gfc_expr gfc_bad_expr;
@@ -235,7 +236,8 @@ is_constant_array_expr (gfc_expr *e)
for (c = gfc_constructor_first (e->value.constructor);
c; c = gfc_constructor_next (c))
- if (c->expr->expr_type != EXPR_CONSTANT)
+ if (c->expr->expr_type != EXPR_CONSTANT
+ && c->expr->expr_type != EXPR_STRUCTURE)
return false;
return true;
@@ -4550,6 +4552,8 @@ gfc_simplify_pack (gfc_expr *array, gfc_expr *mask, gfc_expr *vector)
return NULL;
result = gfc_get_array_expr (array->ts.type, array->ts.kind, &array->where);
+ if (array->ts.type == BT_DERIVED)
+ result->ts.u.derived = array->ts.u.derived;
array_ctor = gfc_constructor_first (array->value.constructor);
vector_ctor = vector
@@ -4982,6 +4986,8 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp,
result = gfc_get_array_expr (source->ts.type, source->ts.kind,
&source->where);
+ if (source->ts.type == BT_DERIVED)
+ result->ts.u.derived = source->ts.u.derived;
result->rank = rank;
result->shape = gfc_get_shape (rank);
for (i = 0; i < rank; i++)
@@ -5732,6 +5738,8 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp
result = gfc_get_array_expr (source->ts.type, source->ts.kind,
&source->where);
+ if (source->ts.type == BT_DERIVED)
+ result->ts.u.derived = source->ts.u.derived;
result->rank = 1;
result->shape = gfc_get_shape (result->rank);
mpz_init_set_si (result->shape[0], ncopies);
@@ -5750,6 +5758,8 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp
result = gfc_get_array_expr (source->ts.type, source->ts.kind,
&source->where);
+ if (source->ts.type == BT_DERIVED)
+ result->ts.u.derived = source->ts.u.derived;
result->rank = source->rank + 1;
result->shape = gfc_get_shape (result->rank);
@@ -6038,6 +6048,8 @@ gfc_simplify_transpose (gfc_expr *matrix)
if (matrix->ts.type == BT_CHARACTER)
result->ts.u.cl = matrix->ts.u.cl;
+ else if (matrix->ts.type == BT_DERIVED)
+ result->ts.u.derived = matrix->ts.u.derived;
matrix_rows = mpz_get_si (matrix->shape[0]);
matrix_cols = mpz_get_si (matrix->shape[1]);
@@ -6341,6 +6353,8 @@ gfc_simplify_unpack (gfc_expr *vector, gfc_expr *mask, gfc_expr *field)
result = gfc_get_array_expr (vector->ts.type, vector->ts.kind,
&vector->where);
+ if (vector->ts.type == BT_DERIVED)
+ result->ts.u.derived = vector->ts.u.derived;
result->rank = mask->rank;
result->shape = gfc_copy_shape (mask->shape, mask->rank);
@@ -6720,3 +6734,21 @@ gfc_convert_char_constant (gfc_expr *e, bt type ATTRIBUTE_UNUSED, int kind)
else
return NULL;
}
+
+
+gfc_expr *
+gfc_simplify_compiler_options (void)
+{
+ /* FIXME: PR40569 - return the proper compiler arguments. */
+ return gfc_get_character_expr (gfc_default_character_kind,
+ &gfc_current_locus, "", 0);
+}
+
+
+gfc_expr *
+gfc_simplify_compiler_version (void)
+{
+ return gfc_get_character_expr (gfc_default_character_kind,
+ &gfc_current_locus, version_string,
+ strlen (version_string));
+}