http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56582



             Bug #: 56582

           Summary: ICE on negative array index in C++11 constant

                    expression evaluation

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: richard-gccbugzi...@metafoo.co.uk





The C++ expression evaluator is not checking for negative array indices when

indexing string literals. This leads to ICEs and reading arbitrary memory

within the GCC process:



// Reliable ICE

constexpr int n[3] = {}; constexpr int k = n[-1];



// Some random byte

constexpr char c = "foo"[-1000];

Reply via email to