Message ID | 20161205203730.GE2337@redhat.com |
---|---|
State | New |
Headers | show |
Ping. On Mon, Dec 05, 2016 at 09:37:30PM +0100, Marek Polacek wrote: > We were crashing on this invalid test because cp_parser_std_attribute_spec_seq > in cp_parser_statement returned error_mark_node, but the subsequent > attribute_fallthrough_p wasn't prepared for that. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2016-12-05 Marek Polacek <polacek@redhat.com> > > PR c++/78647 > * c-family/c-common.c (attribute_fallthrough_p): Return false for > error_mark_node. > > * g++.dg/parse/error58.C: New. > > diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c > index 0749361..c8e1f0d 100644 > --- gcc/c-family/c-common.c > +++ gcc/c-family/c-common.c > @@ -5558,6 +5558,8 @@ parse_optimize_options (tree args, bool attr_p) > bool > attribute_fallthrough_p (tree attr) > { > + if (attr == error_mark_node) > + return false; > tree t = lookup_attribute ("fallthrough", attr); > if (t == NULL_TREE) > return false; > diff --git gcc/testsuite/g++.dg/parse/error58.C gcc/testsuite/g++.dg/parse/error58.C > index e69de29..5ed6e1e 100644 > --- gcc/testsuite/g++.dg/parse/error58.C > +++ gcc/testsuite/g++.dg/parse/error58.C > @@ -0,0 +1,7 @@ > +// PR c++/78647 > +// { dg-do compile { target c++11 } } > +// { dg-options "-w" } > + > +struct A; > +void foo (); > +void f() { alignas (foo (A)); } // { dg-error "expected" "" } > > Marek Marek
On Mon, Dec 12, 2016 at 06:44:19PM +0100, Marek Polacek wrote: > Ping. > > On Mon, Dec 05, 2016 at 09:37:30PM +0100, Marek Polacek wrote: > > We were crashing on this invalid test because cp_parser_std_attribute_spec_seq > > in cp_parser_statement returned error_mark_node, but the subsequent > > attribute_fallthrough_p wasn't prepared for that. > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > > > 2016-12-05 Marek Polacek <polacek@redhat.com> > > > > PR c++/78647 > > * c-family/c-common.c (attribute_fallthrough_p): Return false for No c-family/ prefix in c-family/ChangeLog. > > error_mark_node. > > > > * g++.dg/parse/error58.C: New. Otherwise LGTM. Jakub
diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c index 0749361..c8e1f0d 100644 --- gcc/c-family/c-common.c +++ gcc/c-family/c-common.c @@ -5558,6 +5558,8 @@ parse_optimize_options (tree args, bool attr_p) bool attribute_fallthrough_p (tree attr) { + if (attr == error_mark_node) + return false; tree t = lookup_attribute ("fallthrough", attr); if (t == NULL_TREE) return false; diff --git gcc/testsuite/g++.dg/parse/error58.C gcc/testsuite/g++.dg/parse/error58.C index e69de29..5ed6e1e 100644 --- gcc/testsuite/g++.dg/parse/error58.C +++ gcc/testsuite/g++.dg/parse/error58.C @@ -0,0 +1,7 @@ +// PR c++/78647 +// { dg-do compile { target c++11 } } +// { dg-options "-w" } + +struct A; +void foo (); +void f() { alignas (foo (A)); } // { dg-error "expected" "" }