All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Olga Telezhnaya" <olyatelezhnaya@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 3/4] ref-filter: merge get_obj and get_object
Date: Tue, 10 Jul 2018 12:29:37 +0200	[thread overview]
Message-ID: <20180710102937.12499-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1807101115570.75@tvgsbejvaqbjf.bet>


> This causes GCC to complain thusly:
> 
> 
> ```
> 2018-07-10T04:59:38.6368270Z ref-filter.c:1477:6: error: variable 'eaten' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> 2018-07-10T04:59:38.6468620Z         if (oi->info.contentp) {
> 2018-07-10T04:59:38.6568710Z             ^~~~~~~~~~~~~~~~~
> 2018-07-10T04:59:38.6669970Z ref-filter.c:1489:7: note: uninitialized use occurs here
> 2018-07-10T04:59:38.6774240Z         if (!eaten)
> 2018-07-10T04:59:38.6874860Z              ^~~~~
> 2018-07-10T04:59:38.6976740Z ref-filter.c:1477:2: note: remove the 'if' if its condition is always true
> 2018-07-10T04:59:38.7072330Z         if (oi->info.contentp) {
> 2018-07-10T04:59:38.7172760Z         ^~~~~~~~~~~~~~~~~~~~~~~
> 2018-07-10T04:59:38.7274040Z ref-filter.c:1466:11: note: initialize the variable 'eaten' to silence this warning
> 2018-07-10T04:59:38.7374670Z         int eaten;
> 2018-07-10T04:59:38.7474870Z                  ^
> 2018-07-10T04:59:38.7575690Z                   = 0
> ```
> 
> (See
> https://mseng.visualstudio.com/VSOnline/_build/results?buildId=6640204&view=logs
> for details)
> 
> I think that GCC is correct, and at the same time, it isn't. Because it
> does not matter whether `eaten` is uninitialized here: 

It's undefined behaviour; 'eaten' is int, and an int may have padding
bits and trap representations.

> if it is, then
> `buf` is NULL, and the `free(buf);` call does nothing in particular.


  reply	other threads:[~2018-07-10 10:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09  8:12 [PATCH 1/4] ref-filter: add info_source to valid_atom Olga Telezhnaya
2018-07-09  8:12 ` [PATCH 3/4] ref-filter: merge get_obj and get_object Olga Telezhnaya
2018-07-10  9:19   ` SZEDER Gábor
2018-07-10  9:23   ` Johannes Schindelin
2018-07-10 10:29     ` SZEDER Gábor [this message]
2018-07-10 10:41       ` Оля Тележная
2018-07-09  8:12 ` [PATCH 2/4] ref-filter: add empty values to technical fields Olga Telezhnaya
2018-07-09 22:39   ` Junio C Hamano
2018-07-10  7:51     ` Оля Тележная
2018-07-09  8:12 ` [PATCH 4/4] ref-filter: use oid_object_info() to get object Olga Telezhnaya
2018-07-13 12:43 ` [PATCH v2 1/4] ref-filter: add info_source to valid_atom Olga Telezhnaya
2018-07-13 12:43   ` [PATCH v2 3/4] ref-filter: merge get_obj and get_object Olga Telezhnaya
2018-07-13 12:43   ` [PATCH v2 4/4] ref-filter: use oid_object_info() to get object Olga Telezhnaya
2018-07-16 20:53     ` Junio C Hamano
2018-07-17  7:44       ` Оля Тележная
2018-07-17 22:17         ` Junio C Hamano
2018-07-13 12:43   ` [PATCH v2 2/4] ref-filter: fill empty fields with empty values Olga Telezhnaya
2018-07-17  8:22   ` [PATCH v3 1/5] ref-filter: add info_source to valid_atom Olga Telezhnaya
2018-07-17  8:22     ` [PATCH v3 3/5] ref-filter: initialize eaten variable Olga Telezhnaya
2018-07-17  8:22     ` [PATCH v3 4/5] ref-filter: merge get_obj and get_object Olga Telezhnaya
2018-07-17  8:22     ` [PATCH v3 2/5] ref-filter: fill empty fields with empty values Olga Telezhnaya
2018-07-17  8:22     ` [PATCH v3 5/5] ref-filter: use oid_object_info() to get object Olga Telezhnaya

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=20180710102937.12499-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=olyatelezhnaya@gmail.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.