* lto-partition.c (lto_balanced_map): Watch overflow.
authorJan Hubicka <hubicka@ucw.cz>
Fri, 23 Feb 2018 18:18:07 +0000 (19:18 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 23 Feb 2018 18:18:07 +0000 (18:18 +0000)
From-SVN: r257939

gcc/lto/ChangeLog
gcc/lto/lto-partition.c

index 62fec49..55013a8 100644 (file)
@@ -1,5 +1,9 @@
 2018-02-08  Jan Hubicka  <hubicka@ucw.cz>
 
+       * lto-partition.c (lto_balanced_map): Watch overflow.
+
+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
index 6055dad..60daafd 100644 (file)
@@ -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);