On Tue, May 24, 2022 at 05:29:56PM +0530, Prathamesh Kulkarni wrote:
> On Fri, 29 Apr 2022 at 19:44, Marek Polacek via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > This patch fixes crashes with invalid attributes.  Arguably it could
> > make sense to assert seen_error() too.
> >
> > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk = GCC 13?
> >
> >         PR c++/96637
> >
> > gcc/ChangeLog:
> >
> >         * attribs.cc (decl_attributes): Check error_mark_node.
> >
> > gcc/cp/ChangeLog:
> >
> >         * decl2.cc (cp_check_const_attributes): Check error_mark_node.
> >
> > gcc/testsuite/ChangeLog:
> >
> >         * g++.dg/parse/error64.C: New test.
> > ---
> >  gcc/attribs.cc                       | 3 +++
> >  gcc/cp/decl2.cc                      | 2 ++
> >  gcc/testsuite/g++.dg/parse/error64.C | 4 ++++
> >  3 files changed, 9 insertions(+)
> >  create mode 100644 gcc/testsuite/g++.dg/parse/error64.C
> >
> > diff --git a/gcc/attribs.cc b/gcc/attribs.cc
> > index b219f878042..ff157dcf81c 100644
> > --- a/gcc/attribs.cc
> > +++ b/gcc/attribs.cc
> > @@ -700,6 +700,9 @@ decl_attributes (tree *node, tree attributes, int flags,
> >       in the same order as in the source.  */
> >    for (tree attr = attributes; attr; attr = TREE_CHAIN (attr))
> >      {
> > +      if (attr == error_mark_node)
> > +       continue;
> Not a comment on the patch specifically, but just wondering if it'd be
> better to use error_operand_p,
> than testing against error_mark_node explicitly ?

Not here, I don't think; it tests more than is needed here.

Marek

Reply via email to