* [PATCH] Fix overflow in fold_const_aggregate_ref_1, PR90213
@ 2019-04-24 13:05 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2019-04-24 13:05 UTC (permalink / raw)
To: gcc-patches
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
Richard.
2019-04-24 Richard Biener <rguenther@suse.de>
PR middle-end/90213
* gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication
by size and BITS_PER_UNIT on poly-wide-ints.
Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c (revision 270537)
+++ gcc/gimple-fold.c (working copy)
@@ -6983,14 +6983,10 @@ fold_const_aggregate_ref_1 (tree t, tree
= wi::sext (wi::to_poly_offset (idx)
- wi::to_poly_offset (low_bound),
TYPE_PRECISION (TREE_TYPE (idx)));
-
+ woffset *= tree_to_uhwi (unit_size);
+ woffset *= BITS_PER_UNIT;
if (woffset.to_shwi (&offset))
{
- /* TODO: This code seems wrong, multiply then check
- to see if it fits. */
- offset *= tree_to_uhwi (unit_size);
- offset *= BITS_PER_UNIT;
-
base = TREE_OPERAND (t, 0);
ctor = get_base_constructor (base, &offset, valueize);
/* Empty constructor. Always fold to 0. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-24 12:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 13:05 [PATCH] Fix overflow in fold_const_aggregate_ref_1, PR90213 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).