aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-12-18 19:51:36 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-12-18 19:51:36 -0800
commit8b0b9aefd29dfe6398857bcf5628662e2f0e21f6 (patch)
tree179abc94a28b4e9128eb4a831fb962539750f0de /gcc
parent00a689881cb5a33822df57e92f86089000a14785 (diff)
downloadgcc-8b0b9aefd29dfe6398857bcf5628662e2f0e21f6.zip
gcc-8b0b9aefd29dfe6398857bcf5628662e2f0e21f6.tar.gz
gcc-8b0b9aefd29dfe6398857bcf5628662e2f0e21f6.tar.bz2
c-decl.c (grokdeclarator): Save variable array size before subtracting 1, rather than after.
* c-decl.c (grokdeclarator): Save variable array size before subtracting 1, rather than after. From-SVN: r92370
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-decl.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e72b847..51ad04e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-18 Richard Henderson <rth@redhat.com>
+
+ * c-decl.c (grokdeclarator): Save variable array size before
+ subtracting 1, rather than after.
+
2004-12-18 Eric Botcazou <ebotcazou@libertysurf.fr>
PR middle-end/15486
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index b728a6b..b76e274 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4084,6 +4084,12 @@ grokdeclarator (const struct c_declarator *declarator,
}
else
{
+ /* Arrange for the SAVE_EXPR on the inside of the
+ MINUS_EXPR, which allows the -1 to get folded
+ with the +1 that happens when building TYPE_SIZE. */
+ if (size_varies)
+ size = variable_size (size);
+
/* Compute the maximum valid index, that is, size
- 1. Do the calculation in index_type, so that
if it is a variable the computations will be
@@ -4107,8 +4113,6 @@ grokdeclarator (const struct c_declarator *declarator,
continue;
}
- if (size_varies)
- itype = variable_size (itype);
itype = build_index_type (itype);
}
}