Fix a miscompilation of GCC due to undefined behavior. This originally

triggered when building with clang on amd64 (under some circumstances),
but is a general issue.

PR:		240387
Kudos to:	dim (for first class detective work)
This commit is contained in:
Gerald Pfeifer 2019-09-22 02:48:28 +00:00
parent 32c4c19c81
commit cdd2862ac0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=512547

View file

@ -0,0 +1,26 @@
This fixes FreeBSD PR240387, a bootstrap failure with clang.
2019-09-20 Richard Biener <rguenther@suse.de>
PR target/91767
* config/i386/i386-features.c (general_scalar_chain::convert_registers):
Ensure there's a sequence point between allocating the new register
and passing a reference to a reg via regno_reg_rtx.
--- UTC
Index: gcc/config/i386/i386-features.c
===================================================================
--- gcc/config/i386/i386-features.c (revision 275988)
+++ gcc/config/i386/i386-features.c (revision 275989)
@@ -1210,7 +1210,10 @@
bitmap_iterator bi;
unsigned id;
EXECUTE_IF_SET_IN_BITMAP (defs_conv, 0, id, bi)
- defs_map.put (regno_reg_rtx[id], gen_reg_rtx (smode));
+ {
+ rtx chain_reg = gen_reg_rtx (smode);
+ defs_map.put (regno_reg_rtx[id], chain_reg);
+ }
EXECUTE_IF_SET_IN_BITMAP (insns_conv, 0, id, bi)
for (df_ref ref = DF_INSN_UID_DEFS (id); ref; ref = DF_REF_NEXT_LOC (ref))
if (bitmap_bit_p (defs_conv, DF_REF_REGNO (ref)))