Commit 6ffc0c0c by Eric Botcazou Committed by Eric Botcazou

re PR c++/82872 (ICE in ignore_overflows on __PTRDIFF_MAX__ index)

	PR c++/82872
	* convert.c (convert_to_integer_1) <POINTER_TYPE>: Do not return the
	shared zero if the input has overflowed.

From-SVN: r255944
parent b3eec1d6
2017-12-21 Eric Botcazou <ebotcazou@adacore.com>
PR c++/82872
* convert.c (convert_to_integer_1) <POINTER_TYPE>: Do not return the
shared zero if the input has overflowed.
2017-12-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2017-12-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/driver-arm.c (arm_cpu_table): Specify dotprod * config/arm/driver-arm.c (arm_cpu_table): Specify dotprod
...@@ -671,7 +671,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold) ...@@ -671,7 +671,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
{ {
case POINTER_TYPE: case POINTER_TYPE:
case REFERENCE_TYPE: case REFERENCE_TYPE:
if (integer_zerop (expr)) if (integer_zerop (expr) && !TREE_OVERFLOW (expr))
return build_int_cst (type, 0); return build_int_cst (type, 0);
/* Convert to an unsigned integer of the correct width first, and from /* Convert to an unsigned integer of the correct width first, and from
......
2017-12-21 Eric Botcazou <ebotcazou@adacore.com>
* c-c++-common/pr82872.c: New test.
2017-12-21 Jakub Jelinek <jakub@redhat.com> 2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/82973 PR rtl-optimization/82973
......
/* PR c++/82872 */
/* { dg-do compile } */
#include <stddef.h>
struct S { int i, a[1]; };
size_t foo (void)
{
return offsetof (struct S, a[__PTRDIFF_MAX__]);
}
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