From: Jan Hubicka Date: Fri, 23 Feb 2018 18:18:07 +0000 (+0100) Subject: * lto-partition.c (lto_balanced_map): Watch overflow. X-Git-Tag: basepoints/gcc-9~1026 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97bb48126b1f09e7751332e7e6ef1d63eb937994;p=thirdparty%2Fgcc.git * lto-partition.c (lto_balanced_map): Watch overflow. From-SVN: r257939 --- diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 62fec4983805..55013a81bb25 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2018-02-08 Jan Hubicka + + * lto-partition.c (lto_balanced_map): Watch overflow. + 2018-02-08 Jan Hubicka PR ipa/81360 diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 6055dad99b50..60daafdf3750 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);