]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR regression/57551 (g++.dg/ext/visibility/anon6.C scan-assembler 1BIiE1cE)
authorJason Merrill <jason@redhat.com>
Tue, 9 Jul 2013 17:55:43 +0000 (13:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 9 Jul 2013 17:55:43 +0000 (13:55 -0400)
PR c++/57551
* semantics.c (cxx_eval_indirect_ref): Don't try to look through
a POINTER_PLUS_EXPR for type punning diagnostic.

From-SVN: r200840

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/expr/const1.C [new file with mode: 0644]

index aa6bdb1f3394c97abe872d80e8cfbcd273228fb3..87892aaf127b364caefead34eecaf3ea96c64aa1 100644 (file)
@@ -1,5 +1,9 @@
 2013-07-09  Jason Merrill  <jason@redhat.com>
 
+       PR c++/57551
+       * semantics.c (cxx_eval_indirect_ref): Don't try to look through
+       a POINTER_PLUS_EXPR for type punning diagnostic.
+
        PR c++/57831
        * pt.c (tsubst_copy): Handle USING_DECL.
 
index c9a292e824944151462741da07a55e0c2ee19b15..e06ac61bb800798787c9d240017bde6e9aff2927 100644 (file)
@@ -7715,11 +7715,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
diff --git a/gcc/testsuite/g++.dg/expr/const1.C b/gcc/testsuite/g++.dg/expr/const1.C
new file mode 100644 (file)
index 0000000..9371b27
--- /dev/null
@@ -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;
+}