public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-2046] Fix initializer_constant_valid_p_1 TYPE_PRECISION use Date: Fri, 23 Jun 2023 12:16:48 +0000 (GMT) [thread overview] Message-ID: <20230623121648.0BB223858404@sourceware.org> (raw) https://gcc.gnu.org/g:2acbbf41d4c2a3362991863ce265041f9a2feee4 commit r14-2046-g2acbbf41d4c2a3362991863ce265041f9a2feee4 Author: Richard Biener <rguenther@suse.de> Date: Fri Jun 23 12:50:50 2023 +0200 Fix initializer_constant_valid_p_1 TYPE_PRECISION use initializer_constant_valid_p_1 is letting through all conversions of float vector types that have the same number of elements but that's of course not valid. The following restricts the code to scalar floating point types as was probably intended (only scalar integer types are handled as well). * varasm.cc (initializer_constant_valid_p_1): Only allow conversions between scalar floating point types. Diff: --- gcc/varasm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/varasm.cc b/gcc/varasm.cc index dd84754a283..f2a19aa6dbd 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -4885,7 +4885,8 @@ initializer_constant_valid_p_1 (tree value, tree endtype, tree *cache) /* Allow length-preserving conversions between integer types and floating-point types. */ if (((INTEGRAL_TYPE_P (dest_type) && INTEGRAL_TYPE_P (src_type)) - || (FLOAT_TYPE_P (dest_type) && FLOAT_TYPE_P (src_type))) + || (SCALAR_FLOAT_TYPE_P (dest_type) + && SCALAR_FLOAT_TYPE_P (src_type))) && (TYPE_PRECISION (dest_type) == TYPE_PRECISION (src_type))) return initializer_constant_valid_p_1 (src, endtype, cache);
reply other threads:[~2023-06-23 12:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230623121648.0BB223858404@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@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).