From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:90382] [Ruby trunk Bug#15299] hash.c: warning: ‘bin’ may be used uninitialized in this function
Date: Sun, 09 Dec 2018 02:32:33 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-75502.20181209023231.847bae7a5e1c69e0@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15299.20181113093909@ruby-lang.org
Issue #15299 has been updated by nobu (Nobuyoshi Nakada).
What version of cc?
It is a false warning.
`bin` is initialized if the hash is not empty, and otherwise `existing` is `FALSE`.
And the line is in a block of `if (existing)`, so unintialized `bin` never reaches there.
----------------------------------------
Bug #15299: hash.c: warning: ‘bin’ may be used uninitialized in this function
https://bugs.ruby-lang.org/issues/15299#change-75502
* Author: duerst (Martin Dürst)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version:
* ruby -v: ruby 2.4.0dev (2016-06-09 trunk 55334) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
When compiling the latest version of trunk, I get some warnings in hash.c, as follows:
```
compiling hash.c
hash.c: In function ‘linear_update’:
hash.c:849:24: warning: ‘bin’ may be used uninitialized in this function [-Wmaybe-uninitialized]
clear_entry(RHASH_ARRAY_REF(hash, bin));
^
hash.c: In function ‘rb_hash_stlike_update’:
hash.c:849:24: warning: ‘bin’ may be used uninitialized in this function [-Wmaybe-uninitialized]
hash.c:811:14: note: ‘bin’ was declared here
unsigned bin;
^
```
This warning appeared already when I reported issue #15279, but I didn't mention it because I hoped it would also disappear when #15279 was fixed.
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2018-12-09 2:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-15299.20181113093909@ruby-lang.org>
2018-11-13 9:39 ` [ruby-core:89780] [Ruby trunk Bug#15299] hash.c: warning: ‘bin’ may be used uninitialized in this function duerst
2018-12-09 2:32 ` nobu [this message]
2018-12-09 3:25 ` [ruby-core:90383] " duerst
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-75502.20181209023231.847bae7a5e1c69e0@ruby-lang.org \
--to=ruby-core@ruby-lang.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.
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).