]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert "c++: Fix a pasto in the PR120471 fix [PR120940]"
authorJakub Jelinek <jakub@redhat.com>
Mon, 7 Jul 2025 07:51:38 +0000 (09:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 7 Jul 2025 07:51:38 +0000 (09:51 +0200)
This reverts commit ed950a9ed384389ff07ac793b7065abe31bcae3f.

gcc/cp/typeck.cc
gcc/testsuite/g++.dg/parse/pr120940.C [deleted file]
gcc/testsuite/g++.dg/warn/Wduplicated-branches9.C [deleted file]

index 2f67bb33ff04fadc497893a6c842b771c82701fa..19dfaf18928ff6299a34e6f61a5c71de650b8b7e 100644 (file)
@@ -3814,7 +3814,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
       tree op0, op1, op2;
       op0 = TREE_OPERAND (array, 0);
       op1 = TREE_OPERAND (array, 1);
-      op2 = TREE_OPERAND (array, 2);
+      op2 = TREE_OPERAND (array, 1);
       if (TREE_SIDE_EFFECTS (idx) || !tree_invariant_p (idx))
        {
          /* If idx could possibly have some SAVE_EXPRs, turning
diff --git a/gcc/testsuite/g++.dg/parse/pr120940.C b/gcc/testsuite/g++.dg/parse/pr120940.C
deleted file mode 100644 (file)
index 5da36b2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// PR c++/120940
-// { dg-do run }
-
-int a[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
-int b[8] = { 9, 10, 11, 12, 13, 14, 15, 16 };
-
-__attribute__((noipa)) int
-foo (int x, int y)
-{
-  return (x ? a : b)[y];
-}
-
-int
-main ()
-{
-  if (foo (1, 4) != 5 || foo (0, 6) != 15)
-    __builtin_abort ();
-}
diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches9.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches9.C
deleted file mode 100644 (file)
index f9fafcd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// PR c++/120940
-// { dg-do compile }
-// { dg-options "-Wduplicated-branches" }
-
-static char a[16][8], b[16][8];
-
-char *
-foo (int x, int y)
-{
-  return (x ? a : b)[y];
-}