https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70172

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Author: msebor
Date: Sat Apr  2 17:14:48 2016
New Revision: 234698

URL: https://gcc.gnu.org/viewcvs?rev=234698&root=gcc&view=rev
Log:
PR c++/67376 - [5/6 regression] Comparison with pointer to past-the-end
        of array fails inside constant expression
PR c++/70170 - [6 regression] bogus not a constant expression error comparing
        pointer to array to null
PR c++/70172 - incorrect reinterpret_cast from integer to pointer error
        on invalid constexpr initialization
PR c++/70228 - insufficient detail in diagnostics for a constexpr out of bounds
        array subscript

gcc/testsuite/ChangeLog:
2016-04-02  Martin Sebor  <mse...@redhat.com>

        PR c++/67376
        PR c++/70170
        PR c++/70172
        PR c++/70228
        * g++.dg/cpp0x/constexpr-array-ptr10.C: New test.
        * g++.dg/cpp0x/constexpr-array-ptr9.C: New test.
        * g++.dg/cpp0x/constexpr-nullptr-1.C: New test.
        * g++.dg/cpp0x/constexpr-array5.C: Adjust text of expected diagnostic.
        * g++.dg/cpp0x/constexpr-string.C: Same.
        * g++.dg/cpp0x/constexpr-wstring2.C: Same.
        * g++.dg/cpp0x/pr65398.C: Same.
        * g++.dg/ext/constexpr-vla1.C: Same.
        * g++.dg/ext/constexpr-vla2.C: Same.
        * g++.dg/ext/constexpr-vla3.C: Same.
        * g++.dg/ubsan/pr63956.C: Same.

gcc/cp/ChangeLog:
2016-04-02  Martin Sebor  <mse...@redhat.com>

        PR c++/67376
        PR c++/70170
        PR c++/70172
        PR c++/70228
        * constexpr.c (diag_array_subscript): New function.
        (cxx_eval_array_reference): Detect out of bounds array indices.

gcc/ChangeLog:
2016-04-02  Martin Sebor  <mse...@redhat.com>

        PR c++/67376
        * fold-const.c (maybe_nonzero_address): New function.
        (fold_comparison): Call it.  Fold equality and relational
        expressions involving null pointers.
        (tree_single_nonzero_warnv_p): Call maybe_nonzero_address.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr9.C
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array5.C
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-string.C
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C
    trunk/gcc/testsuite/g++.dg/cpp0x/pr65398.C
    trunk/gcc/testsuite/g++.dg/ext/constexpr-vla1.C
    trunk/gcc/testsuite/g++.dg/ext/constexpr-vla2.C
    trunk/gcc/testsuite/g++.dg/ext/constexpr-vla3.C
    trunk/gcc/testsuite/g++.dg/ubsan/pr63956.C

Reply via email to