diff options
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 4 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 16 | ||||
-rw-r--r-- | gcc/common.opt | 4 | ||||
-rw-r--r-- | gcc/d/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/d/lang.opt | 2 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr52813.c | 3 |
10 files changed, 54 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c3b9f14..83d4fa4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-01-15 Richard Sandiford <richard.sandiford@arm.com> + + PR inline-asm/52813 + * doc/extend.texi: Document that listing the stack pointer in the + clobber list of an asm is a deprecated feature. + * common.opt (Wdeprecated): Moved from c-family/c.opt. + * cfgexpand.c (asm_clobber_reg_is_valid): Issue a -Wdeprecated + warning instead of an error for clobbers of the stack pointer. + Add a note explaining why. + 2019-01-15 Richard Biener <rguenther@suse.de> PR debug/88046 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 10e5cc1..03ea65b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2019-01-15 Richard Sandiford <richard.sandiford@arm.com> + + PR inline-asm/52813 + * c.opt (Wdeprecated): Move documentation and variable to common.opt. + 2019-01-14 Jakub Jelinek <jakub@redhat.com> * c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 858beff..88c72c5 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -477,8 +477,8 @@ C++ ObjC++ Var(warn_delnonvdtor) Warning LangEnabledBy(C++ ObjC++,Wall || Weffc+ Warn about deleting polymorphic objects with non-virtual destructors. Wdeprecated -C C++ ObjC ObjC++ CPP(cpp_warn_deprecated) CppReason(CPP_W_DEPRECATED) Var(warn_deprecated) Init(1) Warning -Warn if a deprecated compiler feature, class, method, or field is used. +C C++ ObjC ObjC++ CPP(cpp_warn_deprecated) CppReason(CPP_W_DEPRECATED) +; Documented in common.opt Wdeprecated-copy C++ ObjC++ Var(warn_deprecated_copy) Warning LangEnabledBy(C++ ObjC++, Wextra) diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 3b7a6e5..2337c63 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2872,12 +2872,16 @@ asm_clobber_reg_is_valid (int regno, int nregs, const char *regname) error ("PIC register clobbered by %qs in %<asm%>", regname); is_valid = false; } - /* Clobbering the STACK POINTER register is an error. */ - if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM)) - { - error ("Stack Pointer register clobbered by %qs in %<asm%>", 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 + the usual sense. Adding the stack pointer to the clobber list has + traditionally had some undocumented and somewhat obscure side-effects. */ + if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM) + && warning (OPT_Wdeprecated, "listing the stack pointer register" + " %qs in a clobber list is deprecated", regname)) + inform (input_location, "the value of the stack pointer after an %<asm%>" + " statement must be the same as it was before the statement"); return is_valid; } diff --git a/gcc/common.opt b/gcc/common.opt index 035f2ba..9a5e9af 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -579,6 +579,10 @@ Wattribute-warning Common Var(warn_attribute_warning) Init(1) Warning Warn about uses of __attribute__((warning)) declarations. +Wdeprecated +Common Var(warn_deprecated) Init(1) Warning +Warn if a deprecated compiler feature, class, method, or field is used. + Wdeprecated-declarations Common Var(warn_deprecated_decl) Init(1) Warning Warn about uses of __attribute__((deprecated)) declarations. diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 6fa01f5..974b098 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,8 @@ +2019-01-15 Richard Sandiford <richard.sandiford@arm.com> + + PR inline-asm/52813 + * lang.opt (Wdeprecated): Reference common.opt instead of c.opt. + 2019-01-12 Iain Buclaw <ibuclaw@gdcproject.org> * README.gcc: New file. diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt index 52ddd77..83d3d21 100644 --- a/gcc/d/lang.opt +++ b/gcc/d/lang.opt @@ -124,7 +124,7 @@ Warn about casts that will produce a null result. Wdeprecated D -; Documented in C +; Documented in common.opt Werror D diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index c81092d..eb1cde4 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9441,6 +9441,15 @@ When the compiler selects which registers to use to represent input and output operands, it does not use any of the clobbered registers. As a result, clobbered registers are available for any use in the assembler code. +Another restriction is that the clobber list should not contain the +stack pointer register. This is because the compiler requires the +value of the stack pointer to be the same after an @code{asm} +statement as it was on entry to the statement. However, previous +versions of GCC did not enforce this rule and allowed the stack +pointer to appear in the list, with unclear semantics. This behavior +is deprecated and listing the stack pointer may become an error in +future versions of GCC@. + Here is a realistic example for the VAX showing the use of clobbered registers: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b0689d..e4fbb15 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-01-15 Richard Sandiford <richard.sandiford@arm.com> + + PR inline-asm/52813 + * gcc.target/i386/pr52813.c (test1): Turn the diagnostic into a + -Wdeprecated warning and expect a following note:. + 2019-01-15 Richard Biener <rguenther@suse.de> PR debug/88046 diff --git a/gcc/testsuite/gcc.target/i386/pr52813.c b/gcc/testsuite/gcc.target/i386/pr52813.c index 154ebbf..8772cfb 100644 --- a/gcc/testsuite/gcc.target/i386/pr52813.c +++ b/gcc/testsuite/gcc.target/i386/pr52813.c @@ -5,5 +5,6 @@ void test1 (void) { - asm volatile ("" : : : "%esp"); /* { dg-error "Stack Pointer register clobbered" } */ + asm volatile ("" : : : "%esp"); /* { dg-warning "listing the stack pointer register '%esp' in a clobber list is deprecated" } */ + /* { dg-message "note: the value of the stack pointer after an 'asm' statement must be the same as it was before the statement" "" { target *-*-* } .-1 } */ } |