aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorToon Moene <toon@moene.indiv.nluug.nl>2002-02-13 08:39:56 +0100
committerToon Moene <toon@gcc.gnu.org>2002-02-13 07:39:56 +0000
commit3a44d5398e0652759de5c863e7e74ad386b054c8 (patch)
tree986e05ea00539663ba5d12e1bb83d5cbb5864b2b /gcc
parentca77b9e123f2a889909da2e7b6cb6c5dd83a7ffc (diff)
downloadgcc-3a44d5398e0652759de5c863e7e74ad386b054c8.zip
gcc-3a44d5398e0652759de5c863e7e74ad386b054c8.tar.gz
gcc-3a44d5398e0652759de5c863e7e74ad386b054c8.tar.bz2
data.c (ffedata_eval_offset_): Only convert index...
2002-02-13 Toon Moene <toon@moene.indiv.nluug.nl> * data.c (ffedata_eval_offset_): Only convert index, low and high bound in data statements to default integer if they are constants. Use a copy of the data structure. From-SVN: r49721
Diffstat (limited to 'gcc')
-rw-r--r--gcc/f/ChangeLog6
-rw-r--r--gcc/f/data.c70
2 files changed, 46 insertions, 30 deletions
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index c48a661..4d78371 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,9 @@
+2002-02-13 Toon Moene <toon@moene.indiv.nluug.nl>
+
+ * data.c (ffedata_eval_offset_): Only convert index,
+ low and high bound in data statements to default integer
+ if they are constants. Use a copy of the data structure.
+
2002-02-09 Toon Moene <toon@moene.indiv.nluug.nl>
* data.c (ffedata_eval_offset_): Convert non-default integer
diff --git a/gcc/f/data.c b/gcc/f/data.c
index 08ffa74..3e1ae62 100644
--- a/gcc/f/data.c
+++ b/gcc/f/data.c
@@ -978,6 +978,7 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims)
while (subscripts != NULL)
{
ffeinfoKindtype sub_kind, low_kind, hi_kind;
+ ffebld sub1, low1, hi1;
++rank;
assert (dims != NULL);
@@ -986,16 +987,19 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims)
dim = ffebld_head (dims);
assert (ffeinfo_basictype (ffebld_info (subscript)) == FFEINFO_basictypeINTEGER);
- /* Force to default - it's a constant expression ! */
- sub_kind = ffeinfo_kindtype (ffebld_info (subscript));
- if (sub_kind == FFEINFO_kindtypeINTEGER2)
- subscript->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) subscript->u.conter.expr->u.integer2;
- else if (sub_kind == FFEINFO_kindtypeINTEGER3)
- subscript->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) subscript->u.conter.expr->u.integer3;
- else if (sub_kind == FFEINFO_kindtypeINTEGER4)
- subscript->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) subscript->u.conter.expr->u.integer4;
- ffeinfo_kindtype (ffebld_info (subscript)) = FFEINFO_kindtypeINTEGERDEFAULT;
- value = ffedata_eval_integer1_ (subscript);
+ if (ffebld_op (subscript) == FFEBLD_opCONTER)
+ {
+ /* Force to default - it's a constant expression ! */
+ sub_kind = ffeinfo_kindtype (ffebld_info (subscript));
+ sub1 = ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val (
+ sub_kind == FFEINFO_kindtypeINTEGER2 ? subscript->u.conter.expr->u.integer2 :
+ sub_kind == FFEINFO_kindtypeINTEGER3 ? subscript->u.conter.expr->u.integer3 :
+ sub_kind == FFEINFO_kindtypeINTEGER4 ? subscript->u.conter.expr->u.integer4 :
+ subscript->u.conter.expr->u.integer1), NULL);
+ value = ffedata_eval_integer1_ (sub1);
+ }
+ else
+ value = ffedata_eval_integer1_ (subscript);
assert (ffebld_op (dim) == FFEBLD_opBOUNDS);
low = ffebld_left (dim);
@@ -1006,29 +1010,35 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims)
else
{
assert (ffeinfo_basictype (ffebld_info (low)) == FFEINFO_basictypeINTEGER);
- /* Force to default - it's a constant expression ! */
- low_kind = ffeinfo_kindtype (ffebld_info (low));
- if (low_kind == FFEINFO_kindtypeINTEGER2)
- low->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) low->u.conter.expr->u.integer2;
- else if (low_kind == FFEINFO_kindtypeINTEGER3)
- low->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) low->u.conter.expr->u.integer3;
- else if (low_kind == FFEINFO_kindtypeINTEGER4)
- low->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) low->u.conter.expr->u.integer4;
- ffeinfo_kindtype (ffebld_info (low)) = FFEINFO_kindtypeINTEGERDEFAULT;
- lowbound = ffedata_eval_integer1_ (low);
+ if (ffebld_op (low) == FFEBLD_opCONTER)
+ {
+ /* Force to default - it's a constant expression ! */
+ low_kind = ffeinfo_kindtype (ffebld_info (low));
+ low1 = ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val (
+ low_kind == FFEINFO_kindtypeINTEGER2 ? low->u.conter.expr->u.integer2 :
+ low_kind == FFEINFO_kindtypeINTEGER3 ? low->u.conter.expr->u.integer3 :
+ low_kind == FFEINFO_kindtypeINTEGER4 ? low->u.conter.expr->u.integer4 :
+ low->u.conter.expr->u.integer1), NULL);
+ lowbound = ffedata_eval_integer1_ (low1);
+ }
+ else
+ lowbound = ffedata_eval_integer1_ (low);
}
assert (ffeinfo_basictype (ffebld_info (high)) == FFEINFO_basictypeINTEGER);
- /* Force to default - it's a constant expression ! */
- hi_kind = ffeinfo_kindtype (ffebld_info (high));
- if (hi_kind == FFEINFO_kindtypeINTEGER2)
- high->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) high->u.conter.expr->u.integer2;
- else if (hi_kind == FFEINFO_kindtypeINTEGER3)
- high->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) high->u.conter.expr->u.integer3;
- else if (hi_kind == FFEINFO_kindtypeINTEGER4)
- high->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) high->u.conter.expr->u.integer4;
- ffeinfo_kindtype (ffebld_info (high)) = FFEINFO_kindtypeINTEGERDEFAULT;
- highbound = ffedata_eval_integer1_ (high);
+ if (ffebld_op (high) == FFEBLD_opCONTER)
+ {
+ /* Force to default - it's a constant expression ! */
+ hi_kind = ffeinfo_kindtype (ffebld_info (high));
+ hi1 = ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val (
+ hi_kind == FFEINFO_kindtypeINTEGER2 ? high->u.conter.expr->u.integer2 :
+ hi_kind == FFEINFO_kindtypeINTEGER3 ? high->u.conter.expr->u.integer3 :
+ hi_kind == FFEINFO_kindtypeINTEGER4 ? high->u.conter.expr->u.integer4 :
+ high->u.conter.expr->u.integer1), NULL);
+ highbound = ffedata_eval_integer1_ (hi1);
+ }
+ else
+ highbound = ffedata_eval_integer1_ (high);
if ((value < lowbound) || (value > highbound))
{