From b19fea61d3fba8266bc4f806dc9c5eec327188c1 Mon Sep 17 00:00:00 2001 From: hubicka Date: Fri, 23 Feb 2018 18:18:07 +0000 Subject: [PATCH] * lto-partition.c (lto_balanced_map): Watch overflow. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257939 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/lto/ChangeLog | 4 ++++ gcc/lto/lto-partition.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 62fec498380..55013a81bb2 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,5 +1,9 @@ 2018-02-08 Jan Hubicka + * lto-partition.c (lto_balanced_map): Watch overflow. + +2018-02-08 Jan Hubicka + 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 6055dad99b5..60daafdf375 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -757,7 +757,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); -- 2.11.4.GIT