diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/calls.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr81650.c | 9 |
4 files changed, 38 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 466afb9..f7b620c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2017-08-03 Jakub Jelinek <jakub@redhat.com> + PR driver/81650 + * calls.c (alloc_max_size): Use HOST_WIDE_INT_UC (10??) + instead of 10??LU, perform unit multiplication in wide_int, + don't change alloc_object_size_limit if the limit is larger + than SSIZE_MAX. + PR tree-optimization/81655 PR tree-optimization/81588 * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Handle also diff --git a/gcc/calls.c b/gcc/calls.c index 8a23b50..6405f48 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1222,32 +1222,38 @@ alloc_max_size (void) else if (!strcasecmp (end, "KiB") || strcmp (end, "KB")) unit = 1024; else if (!strcmp (end, "MB")) - unit = 1000LU * 1000; + unit = HOST_WIDE_INT_UC (1000) * 1000; else if (!strcasecmp (end, "MiB")) - unit = 1024LU * 1024; + unit = HOST_WIDE_INT_UC (1024) * 1024; else if (!strcasecmp (end, "GB")) - unit = 1000LU * 1000 * 1000; + unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000; else if (!strcasecmp (end, "GiB")) - unit = 1024LU * 1024 * 1024; + unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024; else if (!strcasecmp (end, "TB")) - unit = 1000LU * 1000 * 1000 * 1000; + unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000; else if (!strcasecmp (end, "TiB")) - unit = 1024LU * 1024 * 1024 * 1024; + unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024; else if (!strcasecmp (end, "PB")) - unit = 1000LU * 1000 * 1000 * 1000 * 1000; + unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000; else if (!strcasecmp (end, "PiB")) - unit = 1024LU * 1024 * 1024 * 1024 * 1024; + unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024; else if (!strcasecmp (end, "EB")) - unit = 1000LU * 1000 * 1000 * 1000 * 1000 * 1000; + unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000 + * 1000; else if (!strcasecmp (end, "EiB")) - unit = 1024LU * 1024 * 1024 * 1024 * 1024 * 1024; + unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024 + * 1024; else unit = 0; } if (unit) - alloc_object_size_limit - = build_int_cst (ssizetype, limit * unit); + { + wide_int w = wi::uhwi (limit, HOST_BITS_PER_WIDE_INT + 64); + w *= unit; + if (wi::ltu_p (w, alloc_object_size_limit)) + alloc_object_size_limit = wide_int_to_tree (ssizetype, w); + } } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58e1b87..53829f7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-03 Jakub Jelinek <jakub@redhat.com> + + PR driver/81650 + * gcc.dg/pr81650.c: New test. + 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/71440 diff --git a/gcc/testsuite/gcc.dg/pr81650.c b/gcc/testsuite/gcc.dg/pr81650.c new file mode 100644 index 0000000..99e84de --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81650.c @@ -0,0 +1,9 @@ +/* PR driver/81650 */ +/* { dg-do compile } */ +/* { dg-options "-Walloc-size-larger-than=9223372036854775807" } */ + +void * +foo (void) +{ + return __builtin_malloc (5); +} |