Message ID | CAEwic4YDKvn=YqzfpKAUyWUEMS-LkCdDwzeOaXd=jt-2n_5-ag@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Thu, Dec 04, 2014 at 04:12:02PM +0100, Kai Tietz wrote: > Hi, > > this patch fixes an ICE happening on invalid code for < c++11. It is > reasoned by > accessing blindly identifier without checking that it is a declaration. > > ChangeLog > > 2014-12-04 Kai Tietz <ktietz@redhat.com> > > PR c++/64127 > * parser.c (cp_parser_diagnose_invalid_type_name): Check > id for being a declaration before accessing identifier. > > Tested on x86_64-unknown-linux-gnu. > > Ok for apply? Testcase? Marek
2014-12-04 16:47 GMT+01:00 Marek Polacek <polacek@redhat.com>: > On Thu, Dec 04, 2014 at 04:12:02PM +0100, Kai Tietz wrote: >> Hi, >> >> this patch fixes an ICE happening on invalid code for < c++11. It is >> reasoned by >> accessing blindly identifier without checking that it is a declaration. >> >> ChangeLog >> >> 2014-12-04 Kai Tietz <ktietz@redhat.com> >> >> PR c++/64127 >> * parser.c (cp_parser_diagnose_invalid_type_name): Check >> id for being a declaration before accessing identifier. >> >> Tested on x86_64-unknown-linux-gnu. >> >> Ok for apply? > > Testcase? > > Marek Same as said before. Issue is a invalid-code bug with ICE, and error-messages are pretty meaningless. It would be helpful to have in testsuite just the opportunity to test for no ICE. Anyway, if testcase is requested, I can add it to g++.dg/ collection Kai
On Thu, Dec 04, 2014 at 04:59:21PM +0100, Kai Tietz wrote: > Same as said before. Issue is a invalid-code bug with ICE, and > error-messages are pretty meaningless. It would be helpful to have in > testsuite just the opportunity to test for no ICE. You can add just // { dg-error "" } on all lines that are diagnosed, the ICE should FAIL the test anyway. Please verify it by checking the testcase fails without the patch and succeeeds with the patch. > Anyway, if testcase is requested, I can add it to g++.dg/ collection Yes, please. Jakub
On 12/04/2014 10:12 AM, Kai Tietz wrote: > else if (cxx_dialect < cxx11 > + && DECL_P (id) > && !strcmp (IDENTIFIER_POINTER (id), "thread_local")) This doesn't make any sense: If it's a decl it isn't an identifier. Did you mean to check for IDENTIFIER_NODE? Jason
2014-12-04 20:35 GMT+01:00 Jason Merrill <jason@redhat.com>: > On 12/04/2014 10:12 AM, Kai Tietz wrote: >> >> else if (cxx_dialect < cxx11 >> + && DECL_P (id) >> && !strcmp (IDENTIFIER_POINTER (id), "thread_local")) > > > This doesn't make any sense: If it's a decl it isn't an identifier. Did you > mean to check for IDENTIFIER_NODE? > > Jason > Sure ...
Index: parser.c =================================================================== --- parser.c (Revision 218309) +++ parser.c (Arbeitskopie) @@ -2977,6 +2977,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *p inform (location, "C++11 %<noexcept%> only available with " "-std=c++11 or -std=gnu++11"); else if (cxx_dialect < cxx11 + && DECL_P (id) && !strcmp (IDENTIFIER_POINTER (id), "thread_local")) inform (location, "C++11 %<thread_local%> only available with " "-std=c++11 or -std=gnu++11");