* PR34351: Please get us the "volatile register" warning back
@ 2008-02-24 8:28 Manuel López-Ibáñez
2008-02-26 2:47 ` Mark Mitchell
2008-02-26 18:08 ` H.J. Lu
0 siblings, 2 replies; 3+ messages in thread
From: Manuel López-Ibáñez @ 2008-02-24 8:28 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 467 bytes --]
This patch enables -Wvolatile-register-var with -Wall fixing PR34351.
Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
OK for 4.4?
Manuel.
2008-02-24 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 34351
* doc/invoke.texi (-Wall): Add -Wvolatile-register-var.
* c-opts.c (c_common_handle_option): Wall enables Wvolatile-register-var.
* common.opt: Move Wvolatile-register-var to...
* c.opt: ...here.
testsuite/
* gcc.dg/pr34351.c: New.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-pr34351.diff --]
[-- Type: text/x-diff; name=fix-pr34351.diff, Size: 3466 bytes --]
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 132166)
+++ gcc/doc/invoke.texi (working copy)
@@ -2670,10 +2670,11 @@ Options} and @ref{Objective-C and Object
-Wunknown-pragmas @gol
-Wunused-function @gol
-Wunused-label @gol
-Wunused-value @gol
-Wunused-variable @gol
+-Wvolatile-register-var @gol
}
Note that some warning flags are not implied by @option{-Wall}. Some of
them warn about constructions that users generally do not consider
questionable, but which occasionally you might wish to check for;
@@ -3999,11 +4000,12 @@ the variable length array.
@item -Wvolatile-register-var
@opindex Wvolatile-register-var
@opindex Wno-volatile-register-var
Warn if a register variable is declared volatile. The volatile
modifier does not inhibit all optimizations that may eliminate reads
-and/or writes to register variables.
+and/or writes to register variables. This warning is enabled by
+@option{-Wall}.
@item -Wdisabled-optimization
@opindex Wdisabled-optimization
@opindex Wno-disabled-optimization
Warn if a requested optimization pass is disabled. This warning does
Index: gcc/testsuite/gcc.dg/pr34351.c
===================================================================
--- gcc/testsuite/gcc.dg/pr34351.c (revision 0)
+++ gcc/testsuite/gcc.dg/pr34351.c (revision 0)
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+register int * volatile x asm ("r13"); /* { dg-warning "optimization may eliminate reads and/or writes to register variables" } */
Index: gcc/c.opt
===================================================================
--- gcc/c.opt (revision 132166)
+++ gcc/c.opt (working copy)
@@ -467,10 +467,14 @@ Do not warn about using variadic macros
Wvla
C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning
Warn if a variable length array is used
+Wvolatile-register-var
+C ObjC C++ ObjC++ Var(warn_volatile_register_var) Warning
+Warn when a register variable is declared volatile
+
Wwrite-strings
C ObjC C++ ObjC++ Var(warn_write_strings) Warning
In C++, nonzero means warn about deprecated conversion from string literals to `char *'. In C, similar warning, except that the conversion is of course not deprecated by the ISO C standard.
Wpointer-sign
Index: gcc/c-opts.c
===================================================================
--- gcc/c-opts.c (revision 132166)
+++ gcc/c-opts.c (working copy)
@@ -405,10 +405,11 @@ c_common_handle_option (size_t scode, co
set_Wstrict_aliasing (value);
warn_address = value;
if (warn_strict_overflow == -1)
warn_strict_overflow = value;
warn_array_bounds = value;
+ warn_volatile_register_var = value;
/* Only warn about unknown pragmas that are not in system
headers. */
warn_unknown_pragmas = value;
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 132166)
+++ gcc/common.opt (working copy)
@@ -212,14 +212,10 @@ Warn when an expression value is unused
Wunused-variable
Common Var(warn_unused_variable) Warning
Warn when a variable is unused
-Wvolatile-register-var
-Common Var(warn_register_var) Warning
-Warn when a register variable is declared volatile
-
Wcoverage-mismatch
Common RejectNegative Var(warn_coverage_mismatch) Warning
Warn instead of error in case profiles in -fprofile-use do not match
aux-info
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PR34351: Please get us the "volatile register" warning back
2008-02-24 8:28 PR34351: Please get us the "volatile register" warning back Manuel López-Ibáñez
@ 2008-02-26 2:47 ` Mark Mitchell
2008-02-26 18:08 ` H.J. Lu
1 sibling, 0 replies; 3+ messages in thread
From: Mark Mitchell @ 2008-02-26 2:47 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: GCC Patches
Manuel López-Ibáñez wrote:
> 2008-02-24 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
>
> PR 34351
> * doc/invoke.texi (-Wall): Add -Wvolatile-register-var.
> * c-opts.c (c_common_handle_option): Wall enables Wvolatile-register-var.
> * common.opt: Move Wvolatile-register-var to...
> * c.opt: ...here.
>
> testsuite/
> * gcc.dg/pr34351.c: New.
OK.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PR34351: Please get us the "volatile register" warning back
2008-02-24 8:28 PR34351: Please get us the "volatile register" warning back Manuel López-Ibáñez
2008-02-26 2:47 ` Mark Mitchell
@ 2008-02-26 18:08 ` H.J. Lu
1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2008-02-26 18:08 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: GCC Patches
The testcase is invalid on targets where r13 isn't a valid register:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35382
H.J.
On Sat, Feb 23, 2008 at 6:13 PM, Manuel López-Ibáñez
<lopezibanez@gmail.com> wrote:
> This patch enables -Wvolatile-register-var with -Wall fixing PR34351.
>
> Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
>
> OK for 4.4?
>
> Manuel.
>
>
> 2008-02-24 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
>
> PR 34351
> * doc/invoke.texi (-Wall): Add -Wvolatile-register-var.
> * c-opts.c (c_common_handle_option): Wall enables Wvolatile-register-var.
> * common.opt: Move Wvolatile-register-var to...
> * c.opt: ...here.
>
> testsuite/
> * gcc.dg/pr34351.c: New.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-26 18:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-24 8:28 PR34351: Please get us the "volatile register" warning back Manuel López-Ibáñez
2008-02-26 2:47 ` Mark Mitchell
2008-02-26 18:08 ` H.J. Lu
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).