The constexpr iteration dereferenced an array element past the end of
the array.

Regstrapped on x86_64-linux-gnu, and tested with -x-arm-wrs-vxworks7r2.
Ok to install?


from Jerome Lambourg <lambo...@adacore.com>
for  gcc/testsuite/ChangeLog

        * g++.dg/cpp1y/constexpr-66093.C: Fix bounds issue.
---
 gcc/testsuite/g++.dg/cpp1y/constexpr-66093.C |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-66093.C 
b/gcc/testsuite/g++.dg/cpp1y/constexpr-66093.C
index ad3169210d29a..3d742cfebd83d 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-66093.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-66093.C
@@ -19,7 +19,7 @@ private:
 
 constexpr A f() {
     A a{};
-    for (int i = 1; i <= n; i++) {
+    for (int i = 0; i < n; i++) {
         a[i] = i;
     }
     return a;

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

Reply via email to