[Bug target/71460] Copying structs can trap (on x86-32) due to SNaN to QNaN
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 9 08:22:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71460
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jamborm at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #5)
> Following patch fixes the failure:
>
> --cut here--
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index b807a9a..4526c7d 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -10310,10 +10310,8 @@ ix86_promote_function_mode (const_tree type,
> machine_mode mode,
> static bool
> ix86_member_type_forces_blk (const_tree field, machine_mode mode)
> {
> - /* Union with XFmode must be in BLKmode. */
> - return (mode == XFmode
> - && (TREE_CODE (DECL_FIELD_CONTEXT (field)) == UNION_TYPE
> - || TREE_CODE (DECL_FIELD_CONTEXT (field)) == QUAL_UNION_TYPE));
> + return (IS_STACK_MODE (mode) && flag_signaling_nans
> + && RECORD_OR_UNION_TYPE_P (DECL_FIELD_CONTEXT (field)));
> }
>
> rtx
> --cut here--
>
> Patch was tested with various -mfpmath=... compile flags. IMO, we don't need
> BLKmode when we copy the value using SSE registers (and the test indeed does
> not fail with -mfpmath=sse), and we still can copy XFmode using x87 regs
> without -fsignalling-nans.
>
> Richi, Joseph - does the new condition look OK to you?
Looks good to me.
Btw, the mentioned SRA issue probably still exists for full scalarization
and re-mat for a call. SRA should probably check member_type_forces_blk
as well before creating full scalarization accesses. Would be nice to
have a testcase for the SRA case as well.
More information about the Gcc-bugs
mailing list