* [PATCH] jfs: fix bogus variable self-initialization
@ 2019-03-22 14:19 Arnd Bergmann
2019-03-22 14:41 ` Dave Kleikamp
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-03-22 14:19 UTC (permalink / raw)
To: Dave Kleikamp
Cc: clang-built-linux, Nick Desaulniers, Nathan Chancellor,
Arnd Bergmann, jfs-discussion, linux-kernel
A statement was originally added in 2006 to shut up a gcc warning,
now but now clang warns about it:
fs/jfs/jfs_txnmgr.c:1932:15: error: variable 'pxd' is uninitialized when used within its own initialization
[-Werror,-Wuninitialized]
pxd_t pxd = pxd; /* truncated extent of xad */
~~~ ^~~
Modern versions of gcc are fine without the silly assignment, so just
drop it. Tested with gcc-4.6 (released 2011), 4.7, 4.8, and 4.9.
Fixes: c9e3ad6021e5 ("JFS: Get rid of "may be used uninitialized" warnings")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/jfs/jfs_txnmgr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index a5663cb621d8..78789c5ed36b 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1928,8 +1928,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
* header ?
*/
if (tlck->type & tlckTRUNCATE) {
- /* This odd declaration suppresses a bogus gcc warning */
- pxd_t pxd = pxd; /* truncated extent of xad */
+ pxd_t pxd; /* truncated extent of xad */
int twm;
/*
--
2.20.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] jfs: fix bogus variable self-initialization
2019-03-22 14:19 [PATCH] jfs: fix bogus variable self-initialization Arnd Bergmann
@ 2019-03-22 14:41 ` Dave Kleikamp
0 siblings, 0 replies; 2+ messages in thread
From: Dave Kleikamp @ 2019-03-22 14:41 UTC (permalink / raw)
To: Arnd Bergmann, Dave Kleikamp
Cc: clang-built-linux, Nick Desaulniers, Nathan Chancellor,
jfs-discussion, linux-kernel
On 3/22/19 9:19 AM, Arnd Bergmann wrote:
> A statement was originally added in 2006 to shut up a gcc warning,
> now but now clang warns about it:
>
> fs/jfs/jfs_txnmgr.c:1932:15: error: variable 'pxd' is uninitialized when used within its own initialization
> [-Werror,-Wuninitialized]
> pxd_t pxd = pxd; /* truncated extent of xad */
> ~~~ ^~~
>
> Modern versions of gcc are fine without the silly assignment, so just
> drop it. Tested with gcc-4.6 (released 2011), 4.7, 4.8, and 4.9.
Thanks Arnd. Will push it upstream.
Shaggy
>
> Fixes: c9e3ad6021e5 ("JFS: Get rid of "may be used uninitialized" warnings")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> ---
> fs/jfs/jfs_txnmgr.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
> index a5663cb621d8..78789c5ed36b 100644
> --- a/fs/jfs/jfs_txnmgr.c
> +++ b/fs/jfs/jfs_txnmgr.c
> @@ -1928,8 +1928,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
> * header ?
> */
> if (tlck->type & tlckTRUNCATE) {
> - /* This odd declaration suppresses a bogus gcc warning */
> - pxd_t pxd = pxd; /* truncated extent of xad */
> + pxd_t pxd; /* truncated extent of xad */
> int twm;
>
> /*
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-22 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 14:19 [PATCH] jfs: fix bogus variable self-initialization Arnd Bergmann
2019-03-22 14:41 ` Dave Kleikamp
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 NNTP newsgroup(s).