Re: Help diagnosing a GCC 10.2 problem : error: 'removed_return.213' may be used uninitialized in this function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Martin, the program crashes, not GCC.

My code does not contain any 'removed_return'. I suspect that it's a GCC thing so it would probably not appear in a -E output.

I'll try again to extract the behavior from the codebase.

Nick



On Wednesday, January 6, 2021, 9:20:19 AM PST, Martin Sebor <msebor@xxxxxxxxx> wrote: 





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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux