summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2019-05-07 17:42:42 +0200
committerUros Bizjak <uros@gcc.gnu.org>2019-05-07 17:42:42 +0200
commit0a59215131c02dee4c8829f93d1ee678647614da (patch)
tree6eb2ab41018cd72b01e17fe77465c63b6837abf0 /gcc/cfgexpand.c
parent73e828becf8d33334800c7a8c83b1d7a8967f2a8 (diff)
cfgexpand.c (asm_clobber_reg_is_valid): Reject clobbers outside of accessible_reg_set.
* cfgexpand.c (asm_clobber_reg_is_valid): Reject clobbers outside of accessible_reg_set. * config/i386/i386.c (ix86_conditional_register_usage): Disable register sets by clearing corresponding bits in accessible_reg_set. Do not set corresponding bits in fixed_regs, call_used_regs and don't clear corresponding reg_names array members. testsuite/ChangeLog: * gcc.target/i386/asm-7.c: New test. * gcc.target/i386/asm-1.c: Update expected error string. * gcc.target/i386/pr62120.c: Ditto. From-SVN: r270955
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 518d71c74c8..3a4bd354bf9 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2874,6 +2874,15 @@ asm_clobber_reg_is_valid (int regno, int nregs, const char *regname)
error ("PIC register clobbered by %qs in %<asm%>", regname);
is_valid = false;
}
+ else if (!in_hard_reg_set_p
+ (accessible_reg_set, reg_raw_mode[regno], regno))
+ {
+ /* ??? Diagnose during gimplification? */
+ error ("the register %qs cannot be clobbered in %<asm%>"
+ " for the current target", regname);
+ is_valid = false;
+ }
+
/* Clobbering the stack pointer register is deprecated. GCC expects
the value of the stack pointer after an asm statement to be the same
as it was before, so no asm can validly clobber the stack pointer in