public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103622] ICE: Segmentation fault (in altivec_resolve_new_overloaded_builtin) Date: Thu, 09 Dec 2021 14:03:08 +0000 [thread overview] Message-ID: <bug-103622-4-JWKqmg2Q7m@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103622-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103622 --- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> --- > One thought seems to check instance->fntype first and take (skip) it as > mismatch if it's NULL. This looks like a bad idea, to use long double as the type instead of float128 when type float128 isn't supported might be better. diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c index d2e9c4ce547..2b87eef1412 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.c +++ b/gcc/config/rs6000/rs6000-gen-builtins.c @@ -2473,6 +2473,39 @@ write_fntype_init (char *str) fprintf (init_file, ",\n\t\t\t\t"); } fprintf (init_file, "NULL_TREE);\n"); + + /* Use long_double_type_node instead if float128_type_node isn't + supported, it's to avoid unexpected function types. */ + if (tf_found) + { + char *buf1 = strdup (str); + fprintf (init_file, " else\n "); + fprintf (init_file, " %s\n = build_function_type_list (", buf1); + tok = strtok (buf1, "_"); + if (!strcmp ("tf", tok)) + write_type_node ("ld", true); + else + write_type_node (tok, true); + tok = strtok (0, "_"); + tok = strtok (0, "_"); + if (tok) + fprintf (init_file, ",\n\t\t\t\t"); + + /* Note: A function with no arguments ends with '_ftype_v'. */ + while (tok && strcmp (tok, "v")) + { + if (!strcmp ("tf", tok)) + write_type_node ("ld", true); + else + write_type_node (tok, true); + tok = strtok (0, "_"); + fprintf (init_file, ",\n\t\t\t\t"); + } + fprintf (init_file, "NULL_TREE);\n"); + + free (buf1); + } + free (buf); } The above hacking make the segfault gone and it will emit: test.c: In function ‘get_float128_exponent’: test.c:6:5: error: ‘__builtin_vsx_scalar_extract_expq’ requires ISA 3.0 IEEE 128-bit floating point 6 | return __builtin_vec_scalar_extract_exp (a); | ^~~~~~ test.c:6:5: note: overloaded builtin ‘__builtin_vec_scalar_extract_exp’ is implemented by builtin ‘__builtin_vsx_scalar_extract_expq’
next prev parent reply other threads:[~2021-12-09 14:03 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-09 7:15 [Bug target/103622] New: " asolokha at gmx dot com 2021-12-09 9:50 ` [Bug target/103622] " linkw at gcc dot gnu.org 2021-12-09 11:48 ` linkw at gcc dot gnu.org 2021-12-09 14:03 ` linkw at gcc dot gnu.org [this message] 2021-12-09 21:24 ` wschmidt at gcc dot gnu.org 2021-12-09 21:37 ` wschmidt at gcc dot gnu.org 2021-12-12 16:44 ` [Bug target/103622] [12 Regression] " wschmidt at gcc dot gnu.org 2021-12-13 13:54 ` wschmidt at gcc dot gnu.org 2021-12-13 14:01 ` wschmidt at gcc dot gnu.org 2021-12-13 16:16 ` wschmidt at gcc dot gnu.org 2021-12-15 2:53 ` linkw at gcc dot gnu.org 2022-01-05 22:54 ` cvs-commit at gcc dot gnu.org 2022-01-06 1:41 ` wschmidt at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-103622-4-JWKqmg2Q7m@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).