diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-03-06 20:05:06 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-03-06 20:05:06 +0000 |
commit | 9bb0081e39b5e12f1bdc263bd52e98d00040b8f3 (patch) | |
tree | 22ee350214f12334fd6b177c908017b987e94b8f | |
parent | de5c5180c21392d7324863f4cda9b4e9da298e8f (diff) | |
download | gcc-9bb0081e39b5e12f1bdc263bd52e98d00040b8f3.tar.gz |
Backport r257939
2018-03-06 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-02-08 Jan Hubicka <hubicka@ucw.cz>
* lto-partition.c (lto_balanced_map): Watch overflow.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@258291 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/lto/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/lto/lto-partition.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index e6faf9420b7..91aadcf5b11 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -3,6 +3,13 @@ Backport from mainline 2018-02-08 Jan Hubicka <hubicka@ucw.cz> + * lto-partition.c (lto_balanced_map): Watch overflow. + +2018-03-06 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2018-02-08 Jan Hubicka <hubicka@ucw.cz> + PR ipa/81360 * lto.c (unify_scc): Register prevailing trees, not trees to be freed. (read_cgraph_and_symbols): Use diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index e27d0d1690c..a624dfa8847 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -756,7 +756,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) if (npartitions < n_lto_partitions) partition_size = total_size / (n_lto_partitions - npartitions); else - partition_size = INT_MAX; + /* Watch for overflow. */ + partition_size = INT_MAX / 16; if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE)) partition_size = PARAM_VALUE (MIN_PARTITION_SIZE); |