From: Martin Sebor <msebor@gmail.com>
To: Nick Savoiu <savoiu@yahoo.com>,
"gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: Help diagnosing a GCC 10.2 problem : error: 'removed_return.213' may be used uninitialized in this function
Date: Wed, 6 Jan 2021 10:20:15 -0700 [thread overview]
Message-ID: <e3c7f16e-a397-d46c-a5dd-0b93c98de497@gmail.com> (raw)
In-Reply-To: <1044085695.4037783.1609882274366@mail.yahoo.com>
On 1/5/21 2:31 PM, Nick Savoiu via Gcc-help wrote:
> Hi all, I'm trying to upgrade a codebase from GCC 9.1 to GCC 10.2 and running into weird warning/error messages in the optimized build (-O2).
>
> error: 'removed_return.213' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> I thought that I can just downgrade the -Werror and go on but the code actually crashes on that statement.
Do you mean to say the compiler crashes or the program crashes at
runtime? The former would be a bug in the compiler. The latter
likely a bug in the program.
The removed_return.213 name refers to a variable GCC synthesizes
internally from one called removed_return in the code. It just
means that GCC can't prove the variable is initialized when it's
used. Initializing it on declaration should avoid the warning.
>
> The problem code seems to be around a macro that looks like this:
>
> extern bool IsDebugOn();
> #define debug IsDebugOn() && std::cout
>
> and that's used like this:
>
> debug << "print something" << std::endl;
>
> The error goes away if I use
>
> if (IsDebugOn())
> debug << "print something" << endl;
>
> so I guess the shortcircuited && somehow makes a difference. Unfortunately this happens way deep in the code and any attempts so far to extract the code such that it still exhibits the problem have failed.
>
> I'd appreciate any pointers.
If you suspect a bug in GCC then, at a minimum, we need to see
the full GCC output (the warning/error, followed by any informational
notes and stack trace if GCC dies with an ICE). Better yet would be
a translation unit (the result of preprocessing the file with -E) and
the full command line so we can reproduce the problem. Since you
mentioned <iostream> it's probably going to be too big for the list
so opening a bug report and attaching the translation unit to it
would be preferable.
Martin
next prev parent reply other threads:[~2021-01-06 17:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1044085695.4037783.1609882274366.ref@mail.yahoo.com>
2021-01-05 21:31 ` Nick Savoiu
2021-01-06 17:20 ` Martin Sebor [this message]
2021-01-06 18:25 ` Nick Savoiu
2021-01-06 19:32 ` Segher Boessenkool
2021-01-13 23:13 ` Nick Savoiu
2021-01-14 19:43 ` Nick Savoiu
2021-01-15 11:03 ` Jonathan Wakely
2021-01-15 16:34 ` Nick Savoiu
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=e3c7f16e-a397-d46c-a5dd-0b93c98de497@gmail.com \
--to=msebor@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=savoiu@yahoo.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 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).