diff options
author | Richard Stallman <rms@gnu.org> | 1992-12-31 08:33:11 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-12-31 08:33:11 +0000 |
commit | 370f6918c29c709f62ec7a9c1265647d87dc1c88 (patch) | |
tree | 3bdb20bc356115a8f5db66fc0505f853b4e7ac6f /gcc | |
parent | cdc5a032d9dd6e37b1f7678897199dc13a7d6ea0 (diff) | |
download | gcc-370f6918c29c709f62ec7a9c1265647d87dc1c88.zip gcc-370f6918c29c709f62ec7a9c1265647d87dc1c88.tar.gz gcc-370f6918c29c709f62ec7a9c1265647d87dc1c88.tar.bz2 |
(layout_record): Avoid overflow in const_size by adding into var_size instead.
From-SVN: r3007
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/stor-layout.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index e280802..3d1ce08 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -451,7 +451,10 @@ layout_record (rec) printed in finish_struct. */ if (dsize == 0) /* Do nothing. */; - else if (TREE_CODE (dsize) == INTEGER_CST) + else if (TREE_CODE (dsize) == INTEGER_CST + && TREE_INT_CST_HIGH (dsize) == 0 + && TREE_INT_CST_LOW (dsize) + const_size > const_size) + /* Use const_size if there's no overflow. */ const_size += TREE_INT_CST_LOW (dsize); else { |