commit 42146ead7b57cd197746a23ce71a1feede1a1303
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jul 9 00:28:33 2013 -0400
PR c++/57551
* semantics.c (cxx_eval_indirect_ref): Don't try to look through
a POINTER_PLUS_EXPR for type punning diagnostic.
@@ -7709,11 +7709,6 @@ cxx_eval_indirect_ref (const constexpr_call *call, tree t,
{
tree sub = op0;
STRIP_NOPS (sub);
- if (TREE_CODE (sub) == POINTER_PLUS_EXPR)
- {
- sub = TREE_OPERAND (sub, 0);
- STRIP_NOPS (sub);
- }
if (TREE_CODE (sub) == ADDR_EXPR)
{
/* We couldn't fold to a constant value. Make sure it's not
new file mode 100644
@@ -0,0 +1,9 @@
+// PR c++/57551
+
+extern unsigned long ADDR;
+
+unsigned long f(){
+ const unsigned long* const var=&ADDR;
+ const unsigned long retval=var[1];
+ return retval;
+}