This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 4/N] Do not ICE on an invalid input for MV.
- From: Martin Liška <mliska at suse dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 14 Mar 2017 13:24:55 +0100
- Subject: Re: [PATCH 4/N] Do not ICE on an invalid input for MV.
- Authentication-results: sourceware.org; auth=none
- References: <cover.1489418416.git.mliska@suse.cz> <5fce5d4b-fd4f-ebf2-a7a9-4c911d606bcc@suse.cz> <CAFiYyc1bnOPJ2LJBAz3Mz5wLm_oP=0Pytad+oU0oyR8_sWw37A@mail.gmail.com>
On 03/14/2017 12:09 PM, Richard Biener wrote:
> On Tue, Mar 14, 2017 at 11:24 AM, Martin Liška <mliska@suse.cz> wrote:
>> Hello.
>>
>> This fixes ICE when one does not provide valid target names:
>> __attribute__((target_clones("default,foo,bar")))
>>
>> In that situation I suggest to print:
>>
>> $ ./xgcc -B. /tmp/mvc-ice.c
>> /tmp/mvc-ice.c:6:1: error: attribute(target("foo")) is unknown
>> foo ()
>> ^~~
>> /tmp/mvc-ice.c:6:1: error: attribute(target("bar")) is unknown
>> /tmp/mvc-ice.c: In function ‘foo.resolver’:
>> cc1: fatal error: At least one more version other than the default is expected
>>
>> Should I add a test-case for a fatal error?
>
> Better avoid fatal_error, can't you just return early after regular error()?
Yep. Early bail out would be better.
>
> Do we error similarly for __attribute__((target_clones("default")))
> from generic code?
>
> I wonder if we can just go ahead even with num_versions == 1?
It's covered in MV pass:
$ ./xgcc -B. /tmp/mvc-single.c
/tmp/mvc-single.c:6:1: warning: single target_clones attribute is ignored
foo ()
Martin
>
>
>>
>> Thanks,
>> Martin
>From 5e7aa55549fabeb4c7fc4b8339dba210c49614d0 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 14 Mar 2017 11:16:51 +0100
Subject: [PATCH] Do not ICE on an invalid input for MV.
gcc/ChangeLog:
2017-03-14 Martin Liska <mliska@suse.cz>
* multiple_target.c (expand_target_clones): Bail out for
an invalid attribute.
---
gcc/multiple_target.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c
index 7b735ae81ae..1e02116a2db 100644
--- a/gcc/multiple_target.c
+++ b/gcc/multiple_target.c
@@ -296,10 +296,7 @@ expand_target_clones (struct cgraph_node *node, bool definition)
if (!targetm.target_option.valid_attribute_p (new_node->decl, NULL,
TREE_VALUE (attributes),
0))
- {
- input_location = saved_loc;
- continue;
- }
+ return false;
input_location = saved_loc;
decl2_v = new_node->function_version ();
--
2.11.1