This very simple repro causes a segfault: __attribute__((target("default"))) int foo() {return 99;} __attribute__((target("sse4.2",""))) int foo() {return 1;} int main() { return foo(); } As you can see, this does dispatch, and should otherwise be valid. However, the blank string causes a segfault: https://godbolt.org/g/dmuCaZ Additionally of interest, ONLY the 1st parameter to target participates in dispatch.
Confirmed, I'll fix that!
Author: marxin Date: Thu Aug 10 07:43:49 2017 New Revision: 251020 URL: https://gcc.gnu.org/viewcvs?rev=251020&root=gcc&view=rev Log: Fix target attribute handling (PR c++/81355). 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * c-attribs.c (handle_target_attribute): Report warning for an empty string argument of target attribute. 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * g++.dg/other/pr81355.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/pr81355.C Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/c-attribs.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk.
Author: aldyh Date: Wed Sep 13 16:47:40 2017 New Revision: 252379 URL: https://gcc.gnu.org/viewcvs?rev=252379&root=gcc&view=rev Log: Fix target attribute handling (PR c++/81355). 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * c-attribs.c (handle_target_attribute): Report warning for an empty string argument of target attribute. 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * g++.dg/other/pr81355.C: New test. Added: branches/range-gen2/gcc/testsuite/g++.dg/other/pr81355.C Modified: branches/range-gen2/gcc/ChangeLog branches/range-gen2/gcc/c-family/c-attribs.c branches/range-gen2/gcc/testsuite/ChangeLog
Author: marxin Date: Fri Sep 15 08:13:58 2017 New Revision: 252785 URL: https://gcc.gnu.org/viewcvs?rev=252785&root=gcc&view=rev Log: Backport r251020 2017-09-15 Martin Liska <mliska@suse.cz> Backport from mainline 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * c-attribs.c (handle_target_attribute): Report warning for an empty string argument of target attribute. 2017-09-15 Martin Liska <mliska@suse.cz> Backport from mainline 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * g++.dg/other/pr81355.C: New test. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/other/pr81355.C Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/c-family/c-attribs.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Author: marxin Date: Fri Sep 15 09:17:18 2017 New Revision: 252795 URL: https://gcc.gnu.org/viewcvs?rev=252795&root=gcc&view=rev Log: Backport r251020 2017-09-15 Martin Liska <mliska@suse.cz> Backport from mainline 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * c-attribs.c (handle_target_attribute): Report warning for an empty string argument of target attribute. 2017-09-15 Martin Liska <mliska@suse.cz> Backport from mainline 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * g++.dg/other/pr81355.C: New test. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/other/pr81355.C Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/c-family/c-common.c branches/gcc-6-branch/gcc/testsuite/ChangeLog
Author: marxin Date: Fri Sep 15 12:14:01 2017 New Revision: 252811 URL: https://gcc.gnu.org/viewcvs?rev=252811&root=gcc&view=rev Log: Backport r251020 2017-09-15 Martin Liska <mliska@suse.cz> Backport from mainline 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * c-attribs.c (handle_target_attribute): Report warning for an empty string argument of target attribute. 2017-09-15 Martin Liska <mliska@suse.cz> Backport from mainline 2017-08-10 Martin Liska <mliska@suse.cz> PR c++/81355 * g++.dg/other/pr81355.C: New test. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/other/pr81355.C Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/c-family/c-common.c branches/gcc-5-branch/gcc/testsuite/ChangeLog
Fixed on all active branches.
Author: marxin Date: Tue Sep 19 08:12:58 2017 New Revision: 252965 URL: https://gcc.gnu.org/viewcvs?rev=252965&root=gcc&view=rev Log: Ignore empty string in target attribute (PR c++/81355). 2017-09-19 Martin Liska <mliska@suse.cz> PR c++/81355 * config/i386/i386.c (sorted_attr_string): Skip empty strings. Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/config/i386/i386.c
Author: marxin Date: Tue Sep 19 08:18:02 2017 New Revision: 252967 URL: https://gcc.gnu.org/viewcvs?rev=252967&root=gcc&view=rev Log: Ignore empty string in target attribute (PR c++/81355). 2017-09-19 Martin Liska <mliska@suse.cz> PR c++/81355 * config/i386/i386.c (sorted_attr_string): Skip empty strings. Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/config/i386/i386.c
Author: marxin Date: Tue Sep 19 09:03:05 2017 New Revision: 252970 URL: https://gcc.gnu.org/viewcvs?rev=252970&root=gcc&view=rev Log: Ignore empty string in target attribute (PR c++/81355). 2017-09-19 Martin Liska <mliska@suse.cz> PR c++/81355 * config/i386/i386.c (sorted_attr_string): Skip empty strings. Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/i386/i386.c