This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 4/N] Do not ICE on an invalid input for MV.
- From: Martin Liška <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Mar 2017 11:24:16 +0100
- Subject: [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>
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?
Thanks,
Martin
>From b00d0845869e82e7607fad692f278083520d6b47 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>
* config/i386/i386.c (dispatch_function_versions): Display fatal
error instead of ICE.
---
gcc/config/i386/i386.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5fcd51f1385..ded9f14d02c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -32670,7 +32670,10 @@ dispatch_function_versions (tree dispatch_decl,
/* At least one more version other than the default. */
num_versions = fndecls->length ();
- gcc_assert (num_versions >= 2);
+ if (num_versions < 2)
+ fatal_error (UNKNOWN_LOCATION,
+ "At least one more version other than the default is "
+ "expected");
function_version_info = (struct _function_version_info *)
XNEWVEC (struct _function_version_info, (num_versions - 1));
--
2.11.1