[PATCH] Fix driver handling of multiple -ftree-parallelize-loops=<n> options (PR driver/69805)

Tom de Vries Tom_deVries@mentor.com
Wed Feb 17 07:14:00 GMT 2016


On 16/02/16 16:24, Jakub Jelinek wrote:
> Hi!
>
> As mentioned in the PR, %{ftree-parallelize-loops=*} expands to
> all -ftree-parallelize-loops= options, not just the last one.
> So greater_than_spec_func is actually called say for
> -ftree-parallelize-loops=0 -ftree-parallelize-loops=2 with
> - ftree-parallelize-loops=0 - ftree-parallelize-loops=2 1
> (each whitespace separated sequence separate arg), but it asserts
> it sees just 3 arguments.
> Passing the - and ftree-parallelize-loops= stuff looks weird,
> and we have %* that substitutes just the variable part of the option,
> so in addition to fixing the case of multiple options I've also changed
> %:gt() behaviour, so that it now gets just the numbers and compares the
> last two of them.  So for the above options it would be called with
> 0 2 1
> and would compare
> 2 > 1
> and return "", or for
> -ftree-parallelize-loops=2 -ftree-parallelize-loops=0 -ftree-parallelize-loops=1
> would be
> 2 0 1 1
> and compare
> 1 > 1
> and return NULL. %:gt() is not used anywhere else, and has been introduced
> only in GCC 6.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2016-02-16  Jakub Jelinek  <jakub@redhat.com>
>
> 	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.
>

Here's the documentation entry for the gt spec function (I forgot to add 
it when introducing the function), using the new semantics.

Copy-pasting from the resulting .info viewed in emacs for a 
human-readable version:
...
      'gt'
           The 'gt' (greater than) function takes one or more arguments.
           It returns either NULL or the empty string.  If it has one
           argument, it returns NULL.  If it has two arguments, it
           compares them: it returns the empty string if the first
           argument is greater than the second argument, otherwise it
           returns NULL.  If it has more than two arguments, it behaves
           as if only the last two arguments were passed.  It can be used
           f.i. as 'S' in a spec directive %{'S':'X'}: if 'S' is NULL,
           the empty string is substituted, and if 'S' is the empty
           string, 'X' is substituted.

                %:gt(%{fsome-option-value=*:%*} 1)
...

OK for stage4 trunk?

Thanks,
- Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-documentation-for-spec-function-gt-in-invoke.texi.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160217/aa3accd4/attachment.bin>


More information about the Gcc-patches mailing list