Commit 2392baa5 by Jakub Jelinek Committed by Jakub Jelinek

re PR driver/81650 (gcc -m32 mishandles -Walloc-size-larger-than=9223372036854775807)

	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.

	* gcc.dg/pr81650.c: New test.

From-SVN: r250850
parent 1f9be505
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
......
......@@ -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);
}
}
}
}
......
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
......
/* PR driver/81650 */
/* { dg-do compile } */
/* { dg-options "-Walloc-size-larger-than=9223372036854775807" } */
void *
foo (void)
{
return __builtin_malloc (5);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment