diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-11-22 10:08:23 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-11-22 10:08:23 +0100 |
commit | 213ffde2eae0d0ee2c15c7ffc7ef481f4f8bee11 (patch) | |
tree | 522d9f9eec82cef79756de6a4422c7288d626530 | |
parent | 608c0f631803f888363bccff43a57027538ff03e (diff) | |
download | gcc-213ffde2eae0d0ee2c15c7ffc7ef481f4f8bee11.zip gcc-213ffde2eae0d0ee2c15c7ffc7ef481f4f8bee11.tar.gz gcc-213ffde2eae0d0ee2c15c7ffc7ef481f4f8bee11.tar.bz2 |
re PR rtl-optimization/82044 (runtime signed integer overflow in check_mem_read_rtx() and all_positions_needed_p() in dse.c)
PR rtl-optimization/82044
PR tree-optimization/82042
* dse.c (record_store): Check for overflow.
(check_mem_read_rtx): Properly check for overflow if width == -1, call
add_wild_read instead of clear_rhs_from_active_local_stores on
overflow and log it into dump_file.
From-SVN: r255048
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/dse.c | 14 |
2 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dc96750..f4b05f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-11-22 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/82044 + PR tree-optimization/82042 + * dse.c (record_store): Check for overflow. + (check_mem_read_rtx): Properly check for overflow if width == -1, call + add_wild_read instead of clear_rhs_from_active_local_stores on + overflow and log it into dump_file. + 2017-11-22 Richard Biener <rguenther@suse.de> * gimple-iterator.c (gimple_find_edge_insert_loc): Ignore @@ -1342,6 +1342,12 @@ record_store (rtx body, bb_info_t bb_info) else width = GET_MODE_SIZE (GET_MODE (mem)); + if (offset > HOST_WIDE_INT_MAX - width) + { + clear_rhs_from_active_local_stores (); + return 0; + } + if (group_id >= 0) { /* In the restrictive case where the base is a constant or the @@ -1981,9 +1987,13 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) else width = GET_MODE_SIZE (GET_MODE (mem)); - if (offset > HOST_WIDE_INT_MAX - width) + if (width == -1 + ? offset == HOST_WIDE_INT_MIN + : offset > HOST_WIDE_INT_MAX - width) { - clear_rhs_from_active_local_stores (); + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, " adding wild read, due to overflow.\n"); + add_wild_read (bb_info); return; } |