[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #8 from Jakub Jelinek --- Fixed.
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 --- Comment #7 from Jakub Jelinek --- Author: jakub Date: Fri Feb 19 22:18:38 2016 New Revision: 233573 URL: https://gcc.gnu.org/viewcvs?rev=233573&root=gcc&view=rev Log: PR driver/69805 * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use :%* in %:gt() argument. (greater_than_spec_func): Adjust for expecting only numbers, if there are more than two numbers, compare the last two. * testsuite/libgomp.c/pr69805.c: New test. Added: trunk/libgomp/testsuite/libgomp.c/pr69805.c Modified: trunk/gcc/ChangeLog trunk/gcc/gcc.c trunk/libgomp/ChangeLog
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 --- Comment #6 from vries at gcc dot gnu.org --- (In reply to vries from comment #3) > I'll follow up with a documentation patch. https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01136.html
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 --- Comment #5 from vries at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #4) > (In reply to vries from comment #3) > > This changes the semantics of greater_than_spec_func slightly. Strictly > > speaking not necessary to fix the ICE. But the new semantics will perhaps be > > easier to understand. > > In fact, I originally changed greater_than_spec_func to assert argc is odd, > and > verify that both argv[0] and argv[argc - 3] is "-" and compared argv[argc - > 2] with argv[argc - 1]. But then I found %* and thought changing the > semantics of %:gt() might be cleaner, allow better composability of spec > language. Agreed. > It could be perhaps even cleaner if we add some spec grammar extension that > gives you the last word from list of words I also wondered about this. We could have '%$' as the '%*' variant that only gives the last entry instead of all the entries (Using '$' as an attempt to make it intuitive by connecting the 'last' meaning to the regexp end-of-line meaning for '$'). But AFAIU, you propose something more generic.
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 --- Comment #4 from Jakub Jelinek --- (In reply to vries from comment #3) > This changes the semantics of greater_than_spec_func slightly. Strictly > speaking not necessary to fix the ICE. But the new semantics will perhaps be > easier to understand. In fact, I originally changed greater_than_spec_func to assert argc is odd, and verify that both argv[0] and argv[argc - 3] is "-" and compared argv[argc - 2] with argv[argc - 1]. But then I found %* and thought changing the semantics of %:gt() might be cleaner, allow better composability of spec language. It could be perhaps even cleaner if we add some spec grammar extension that gives you the last word from list of words, but I didn't want to spend too much time on this.
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 --- Comment #3 from vries at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #2) > Created attachment 37698 [details] > gcc6-pr69805.patch > > Untested fix. > As author of the patch that introduces the problem, let me do a review. > 2016-02-16 Jakub Jelinek > > PR driver/69805 > * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use > :%* in %:gt() argument. > (greater_than_spec_func): Adjust for expecting only numbers, > if there are more than two numbers, compare the last two. > > * testsuite/libgomp.c/pr69805.c: New test. > > --- gcc/gcc.c.jj 2016-02-15 22:22:51.0 +0100 > +++ gcc/gcc.c 2016-02-16 09:35:03.579849080 +0100 > @@ -1019,7 +1019,7 @@ proper position among the other output f > %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \ > %{static:} %{L*} %(mfwrap) %(link_libgcc) " \ > VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \ > -%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1):\ > +%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ For: ... $ gcc -ftree-parallelize-loops=3 -ftree-parallelize-loops=2 ... this passes: ("3", "2", "1") to greater_than_spec_func, instead of: ("-", "ftree-parallelize-loops=3", "-", "ftree-parallelize-loops=2", "1") . This changes the semantics of greater_than_spec_func slightly. Strictly speaking not necessary to fix the ICE. But the new semantics will perhaps be easier to understand. Hmm, I see I forgot to document the spec function in doc/invocation.texi. > @@ -9775,29 +9775,13 @@ greater_than_spec_func (int argc, const >if (argc == 1) > return NULL; > > - gcc_assert (argc == 3); > - gcc_assert (argv[0][0] == '-'); > - gcc_assert (argv[0][1] == '\0'); > - > - /* Point p to in in -opt=. */ > - const char *p = argv[1]; > - while (true) > -{ > - char c = *p; > - if (c == '\0') > -gcc_unreachable (); > + gcc_assert (argc >= 2); > > - ++p; > - > - if (c == '=') > -break; > -} > - Due to the new semantics, no longer any need to skip '-opt='. And 'gcc_assert (argc == 3)' is the assert that triggered. The assert was incorrect because for spec '%{S*}', gcc 'substitutes all the switches specified to GCC whose names start with -S', and the code assumed that only the last is substituted. Patch looks good to me. I'll follow up with a documentation patch.
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED CC||jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- Created attachment 37698 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37698&action=edit gcc6-pr69805.patch Untested fix.
[Bug driver/69805] [6 Regression] ICE in greater_than_spec_func, at gcc.c:9722
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69805 Richard Biener changed: What|Removed |Added Priority|P3 |P1 Status|UNCONFIRMED |NEW Last reconfirmed||2016-02-15 Target Milestone|--- |6.0 Ever confirmed|0 |1 --- Comment #1 from Richard Biener --- Confirmed.