Commit 1e9d6923 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/88410 (internal compiler error: output_operand: invalid expression as operand)

	PR c++/88410
	* cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding,
	call maybe_constant_value on val to see if it is INTEGER_CST.

	* g++.dg/cpp0x/pr88410.C: New test.

From-SVN: r267220
parent f4d458f3
2018-12-17 Jakub Jelinek <jakub@redhat.com>
PR c++/88410
* cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding,
call maybe_constant_value on val to see if it is INTEGER_CST.
2018-12-17 Jonathan Wakely <jwakely@redhat.com> 2018-12-17 Jonathan Wakely <jwakely@redhat.com>
PR c++/52321 PR c++/52321
......
...@@ -2317,6 +2317,7 @@ cp_fold (tree x) ...@@ -2317,6 +2317,7 @@ cp_fold (tree x)
{ {
val = TREE_OPERAND (val, 0); val = TREE_OPERAND (val, 0);
STRIP_NOPS (val); STRIP_NOPS (val);
val = maybe_constant_value (val);
if (TREE_CODE (val) == INTEGER_CST) if (TREE_CODE (val) == INTEGER_CST)
return fold_offsetof (op0, TREE_TYPE (x)); return fold_offsetof (op0, TREE_TYPE (x));
} }
......
2018-12-17 Jakub Jelinek <jakub@redhat.com>
PR c++/88410
* g++.dg/cpp0x/pr88410.C: New test.
2018-12-17 Steve Ellcey <sellcey@cavium.com> 2018-12-17 Steve Ellcey <sellcey@cavium.com>
* gcc.target/aarch64/torture/aarch64-torture.exp: New file. * gcc.target/aarch64/torture/aarch64-torture.exp: New file.
......
// PR c++/88410
// { dg-do compile { target c++11 } }
typedef __UINTPTR_TYPE__ uintptr_t;
const uintptr_t a = 32;
struct C { int b; int c; };
uintptr_t d { uintptr_t (&reinterpret_cast<C *>(a)->c) - a };
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