From: Jakub Jelinek <jakub@redhat.com>
To: Xi Ruoyao <xry111@mengyan1223.wang>
Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek <jakub@gcc.gnu.org>,
Richard Sandiford <richard.sandiford@arm.com>,
YunQiang Su <yunqiang.su@cipunited.com>
Subject: Re: [PATCH] mips: Emit psabi diagnostic for return values affected by C++ zero-width bit-field ABI change [PR 102024]
Date: Thu, 31 Mar 2022 19:04:35 +0200 [thread overview]
Message-ID: <YkXfIAWeeKHRhkXm@tucnak> (raw)
In-Reply-To: <03bbbd29325ec7f76809ef63ef8f92f930442a18.camel@mengyan1223.wang>
On Fri, Apr 01, 2022 at 12:13:30AM +0800, Xi Ruoyao wrote:
> --- a/gcc/config/mips/mips.cc
> +++ b/gcc/config/mips/mips.cc
> @@ -6274,10 +6274,17 @@ mips_callee_copies (cumulative_args_t, const function_arg_info &arg)
>
> For n32 & n64, a structure with one or two fields is returned in
> floating-point registers as long as every field has a floating-point
> - type. */
> + type.
> +
> + The C++ FE used to remove zero-width bit-fields in GCC 11 and earlier.
> + To make a proper diagnostic, this function will set HAS_ZERO_WIDTH_BF
> + to 1 once a C++ zero-width bit-field shows up, and then ignore it.
> + Then the caller can determine if this zero-width bit-field will make a
> + difference and emit a -Wpsabi inform. */
>
> static int
> -mips_fpr_return_fields (const_tree valtype, tree *fields)
> +mips_fpr_return_fields (const_tree valtype, tree *fields,
> + int *has_zero_width_bf)
Use bool * and = true ?
> @@ -6319,11 +6332,14 @@ static bool
> mips_return_in_msb (const_tree valtype)
> {
> tree fields[2];
> + int has_zero_width_bf = 0;
I think it would be better to match more closely what the code did before.
if (!TARGET_NEWABI || !TARGET_BIG_ENDIAN || !AGGREGATE_TYPE_P (valtype))
return false;
tree fields[2];
bool has_zero_width_bf = false;
return (mips_fpr_return_fields (valtype, fields, &has_zero_width_bf) == 0
|| has_zero_width_bf);
> + int use_fpr = mips_fpr_return_fields (valtype, fields,
> + &has_zero_width_bf);
>
> return (TARGET_NEWABI
> && TARGET_BIG_ENDIAN
> && AGGREGATE_TYPE_P (valtype)
> - && mips_fpr_return_fields (valtype, fields) == 0);
> + && (use_fpr == 0 || has_zero_width_bf));
> }
>
> /* Return true if the function return value MODE will get returned in a
> @@ -6418,8 +6434,35 @@ mips_function_value_1 (const_tree valtype, const_tree fn_decl_or_type,
> return values, promote the mode here too. */
> mode = promote_function_mode (valtype, mode, &unsigned_p, func, 1);
>
> + int has_zero_width_bf = 0;
See above for int -> bool and 0 -> false.
> + int use_fpr = mips_fpr_return_fields (valtype, fields,
> + &has_zero_width_bf);
> + if (TARGET_HARD_FLOAT &&
> + warn_psabi &&
> + has_zero_width_bf &&
> + use_fpr != 0)
&&s need to go at the start of next line, not end of line.
> + {
> + static unsigned last_reported_type_uid;
> + unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (valtype));
> + if (uid != last_reported_type_uid)
> + {
> + static const char *url =
Similarly for =
> + CHANGES_ROOT_URL
> + "gcc-12/changes.html#zero_width_bitfields";
> + inform (input_location,
> + "the ABI for returning a value containing "
> + "zero-width bit-fields but otherwise an aggregate "
> + "with only one or two floating-point fields was "
> + "retconned in GCC %{12.1%}", url);
In this diagnostics it is ok to talk about bit-fields as that is
the only thing that changes (compared to the other patch).
But again, was retconned -> changed ?
Jakub
next prev parent reply other threads:[~2022-04-01 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 16:13 Xi Ruoyao
2022-03-31 17:04 ` Jakub Jelinek [this message]
2022-04-01 11:38 ` [PATCH v2] " Xi Ruoyao
2022-04-01 11:41 ` Jakub Jelinek
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=YkXfIAWeeKHRhkXm@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
--cc=xry111@mengyan1223.wang \
--cc=yunqiang.su@cipunited.com \
/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: link
Be 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).