All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Jes Sorensen <jes.sorensen@gmail.com>, Liu Zhilong <zlliu@suse.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
Date: Fri, 07 Apr 2017 09:36:25 +1000	[thread overview]
Message-ID: <87r315yupy.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <a5f537c0-9b73-9a58-7566-0a242e0ff840@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

On Thu, Apr 06 2017, Jes Sorensen wrote:

> On 04/06/2017 04:21 AM, Liu Zhilong wrote:
>> hi,
>>
>> I found this compiling warning, and can reproduce on my Leap42.1,
>> Leap42.2 and SLES12 SP2 with v4.8.5 version of gcc.
>>
>> # gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
>> Target: x86_64-suse-linux
>> Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
>> --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
>> --enable-languages=c,c++,objc,fortran,obj-c++,java,ada
>> --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
>> --enable-ssp --disable-libssp --disable-plugin
>> --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
>> --disable-libgcj --disable-libmudflap --with-slibdir=/lib64
>> --with-system-zlib --enable-__cxa_atexit
>> --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
>> --enable-version-specific-runtime-libs --enable-linker-build-id
>> --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
>> --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
>> --host=x86_64-suse-linux
>> Thread model: posix
>> gcc version 4.8.5 (SUSE Linux)
>>
>> # make everything
>> ... ...
>> mdadm.c: In function ‘main’:
>> mdadm.c:1974:29: error: ‘mdfd’ may be used uninitialized in this
>> function [-Werror=maybe-uninitialized]
>>    if (dv->devname[0] == '/' || mdfd < 0)
>>                              ^
>> mdadm.c:1914:7: note: ‘mdfd’ was declared here
>>    int mdfd;
>>        ^
>> cc1: all warnings being treated as errors
>> Makefile:206: recipe for target 'mdadm.Os' failed
>> make: *** [mdadm.Os] Error 1
>
> Crappy compiler, you're running an old gcc. But sure, send me a patch 
> that initializes mdfd to -1.

I would rather make the code more obviously correct.

		if (dv->devname[0] == '/' ||
		    (mdfd = open_dev(dv->devname)) < 0)
			mdfd = open_mddev(dv->devname, 1);

well... it is more obvious to me.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-04-06 23:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04  5:31 mdadm:compiled warning in mdadm.c:1974:29 treats as errors Zhilong
2017-04-05 15:37 ` jes.sorensen
2017-04-06  8:21   ` Liu Zhilong
2017-04-06 19:10     ` Jes Sorensen
2017-04-06 23:36       ` NeilBrown [this message]
2017-04-07  3:53         ` Liuzhilong
2017-04-07 14:53         ` Jes Sorensen
2017-04-10  4:49           ` [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized" Zhilong Liu
2017-04-11 15:28             ` Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r315yupy.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=zlliu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.