svn commit: r333860 - head/sys/kern

Matthew Macy mmacy at freebsd.org
Thu May 24 05:13:27 UTC 2018


On Wed, May 23, 2018 at 10:07 PM, Gleb Smirnoff <glebius at freebsd.org> wrote:
> Can you please explain the bug supposed to be fixed by r333860 QUESTION MARK

Did I say it fixed a bug? Or are you saying we should just turn off
compiler warnings because Gleb Smirnoff knows better?

-M


> On Wed, May 23, 2018 at 09:51:34PM -0700, Matthew Macy wrote:
> M> Warnings find bugs PERIOD. Although most are not useful, I've found
> M> quite a number of real issues from compiling with gcc8.
> M>
> M> If you want to _actually_ be helpful fix these:
> M> https://people.freebsd.org/~mmacy/gcc8logs/GENERIC-NODEBUG.log
> M>
> M> https://people.freebsd.org/~mmacy/gcc8logs/GENERIC.log
> M>
> M> On Wed, May 23, 2018 at 9:42 PM, Gleb Smirnoff <glebius at freebsd.org> wrote:
> M> > Let me repeat again. The warning is a false positive, and thus assignment
> M> > isn't useful. I'm not worried about a single instruction, more about
> M> > polluting the code.
> M> >
> M> > If the warning was escalated to build error, and we did carry about
> M> > building with gcc8, in this case the assignment should be added with
> M> > a comment /* pacify gcc */.
> M> >
> M> > On Wed, May 23, 2018 at 03:59:33PM -0700, Matthew Macy wrote:
> M> > M> On Wed, May 23, 2018 at 3:57 PM, Gleb Smirnoff <glebius at freebsd.org> wrote:
> M> > M> > The initialization isn't useful.
> M> > M>
> M> > M> It silences a gcc warning. So yes it is. It's this exchange which is not useful.
> M> > M>
> M> > M> -M
> M> > M>
> M> > M>
> M> > M> > On Wed, May 23, 2018 at 03:52:42PM -0700, Matthew Macy wrote:
> M> > M> > M> Talk to the gcc devs. The warning is useful even if there are false positives.
> M> > M> > M>
> M> > M> > M> On Wed, May 23, 2018 at 3:27 PM, Gleb Smirnoff <glebius at freebsd.org> wrote:
> M> > M> > M> >   Hi,
> M> > M> > M> >
> M> > M> > M> > On Sat, May 19, 2018 at 05:10:52AM +0000, Matt Macy wrote:
> M> > M> > M> > M> Author: mmacy
> M> > M> > M> > M> Date: Sat May 19 05:10:51 2018
> M> > M> > M> > M> New Revision: 333860
> M> > M> > M> > M> URL: https://svnweb.freebsd.org/changeset/base/333860
> M> > M> > M> > M>
> M> > M> > M> > M> Log:
> M> > M> > M> > M>   sendfile: annotate unused value and ensure that npages is actually initialized
> M> > M> > M> > M>
> M> > M> > M> > M> Modified:
> M> > M> > M> > M>   head/sys/kern/kern_sendfile.c
> M> > M> > M> > M>
> M> > M> > M> > M> Modified: head/sys/kern/kern_sendfile.c
> M> > M> > M> > M> ==============================================================================
> M> > M> > M> > M> --- head/sys/kern/kern_sendfile.c    Sat May 19 05:09:10 2018        (r333859)
> M> > M> > M> > M> +++ head/sys/kern/kern_sendfile.c    Sat May 19 05:10:51 2018        (r333860)
> M> > M> > M> > M> @@ -341,7 +341,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
> M> > M> > M> > M>      }
> M> > M> > M> > M>
> M> > M> > M> > M>      for (int i = 0; i < npages;) {
> M> > M> > M> > M> -            int j, a, count, rv;
> M> > M> > M> > M> +            int j, a, count, rv __unused;
> M> > M> > M> > M>
> M> > M> > M> > M>              /* Skip valid pages. */
> M> > M> > M> > M>              if (vm_page_is_valid(pa[i], vmoff(i, off) & PAGE_MASK,
> M> > M> > M> > M> @@ -688,6 +688,7 @@ retry_space:
> M> > M> > M> > M>                      if (space == 0) {
> M> > M> > M> > M>                              sfio = NULL;
> M> > M> > M> > M>                              nios = 0;
> M> > M> > M> > M> +                            npages = 0;
> M> > M> > M> > M>                              goto prepend_header;
> M> > M> > M> > M>                      }
> M> > M> > M> > M>                      hdr_uio = NULL;
> M> > M> > M> >
> M> > M> > M> > This initialization is redundant and a compiler warning if exists is wrong.
> M> > M> > M> >
> M> > M> > M> > If we jump down to prepend_header with nios == 0, we won't ever use npages.
> M> > M> > M> >
> M> > M> > M> > --
> M> > M> > M> > Gleb Smirnoff
> M> > M> >
> M> > M> > --
> M> > M> > Gleb Smirnoff
> M> >
> M> > --
> M> > Gleb Smirnoff
>
> --
> Gleb Smirnoff


More information about the svn-src-all mailing list