zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Used-uninitalized error I hadn't seen before
Date: Fri, 7 Sep 2018 16:51:18 -0700	[thread overview]
Message-ID: <CAH+w=7Ycz08GLb6HPh5KdKmROg_ixPwoaxpXTuhhSwamjqgu6w@mail.gmail.com> (raw)
In-Reply-To: <42391-1536362558.149296@9SUZ.DmAr.oCmA>

On Fri, Sep 7, 2018 at 4:22 PM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
>
> What compiler is this and what options? I don't get the warning with any
> compiler I've got. It'd be useful to track down which uses of the
> variable cause the warning.

This is on what I have to assume (I'm not the admin) is a stock CentOS 6.9 host:

gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I.
-DHAVE_CONFIG_H -DMODULE -Wall -Wmissing-prototypes -O2 -fPIC -o
computil..o computil.c

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)

> I'm fairly sure that it is wrong and grplen can't be used uninitialized.

So we have this:

   1847             if (sep > x) { /* exclusion included a set or group name */
   1848                 grp = x;
   1849                 grplen = sep - grp;
   1850                 x = sep;
   1851             }

and then later uses of grplen are protected by expressions like

   1853             if (excludeall || (x[0] == ':' && !x[1])) {
   1854                 if (grp) {

e.g., at line 1858 grplen is passed to strncmp() and at line 1859 is
used in a subscript.  It's not obvious to me why the conditions on
1853-1854 are a superset of 1847.

      reply	other threads:[~2018-09-07 23:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07 19:44 Bart Schaefer
2018-09-07 23:22 ` Oliver Kiddle
2018-09-07 23:51   ` Bart Schaefer [this message]

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='CAH+w=7Ycz08GLb6HPh5KdKmROg_ixPwoaxpXTuhhSwamjqgu6w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).