This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71184] ICE on "operator new["


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

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Thu May 19 18:56:47 2016
New Revision: 236485

URL: https://gcc.gnu.org/viewcvs?rev=236485&root=gcc&view=rev
Log:
PR c++/71184: Fix NULL dereference in cp_parser_operator

The source-range handling for the array form of operator
new/delete erroneously assumed that the "]" was present,
leading to a dereference of NULL when it's absent.

Fix it thusly.

gcc/cp/ChangeLog:
        Backport from trunk r236483.
        PR c++/71184
        * parser.c (cp_parser_operator): For array new/delete, check that
        cp_parser_require returned a non-NULL token before dereferencing
        it.

gcc/testsuite/ChangeLog:
        Backport from trunk r236483.
        PR c++/71184
        * g++.dg/pr71184.C: New test case.


Added:
    branches/gcc-6-branch/gcc/testsuite/g++.dg/pr71184.C
Modified:
    branches/gcc-6-branch/gcc/cp/ChangeLog
    branches/gcc-6-branch/gcc/cp/parser.c
    branches/gcc-6-branch/gcc/testsuite/ChangeLog

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]