diff mbox series

Re: error: ‘EVRP_MODE_DEBUG’ was not declared – was: [PUSHED] Ranger classes.

Message ID b9e2fb20-7869-da76-2c01-f1bb1e7b477a@redhat.com
State New
Headers show
Series Re: error: ‘EVRP_MODE_DEBUG’ was not declared – was: [PUSHED] Ranger classes. | expand

Commit Message

Andrew MacLeod Oct. 26, 2020, 2:24 p.m. UTC
On 10/25/20 8:37 PM, Maciej W. Rozycki wrote:
> On Tue, 6 Oct 2020, Andrew MacLeod via Gcc-patches wrote:
>
>>>> Build fails here now with: gimple-range.h:168:59: error:
>>>> ‘EVRP_MODE_DEBUG’ was not declared in this scope
>>>>
>>> And now builds – as the "Hybrid EVRP and testcases" was pushed as well,
>>> a bit more than a quarter of an hour later. (At least it finished
>>> building the compiler itself, I do not expect surprises in the library
>>> parts.)
>>>
>>> Tobias
>> Guess I should have just pushed it all as one commit. I thought the first part
>> was pretty separate from the second... and it was except for one line :-P  of
>> course I had problems getting the second one out or it would have followed
>> quicker.
>   It is still broken at `-O0', does not build with `--enable-werror-always'
> (which IMO should be on by default except for releases, just as we do with
> binutils AFAIK, so as to make sure people do not introduce build problems
> too easily):
>
> .../gcc/gimple-range.cc: In function 'bool range_of_builtin_call(range_query&, irange&, gcall*)':
> .../gcc/gimple-range.cc:677:15: error: 'zerov' may be used uninitialized [-Werror=maybe-uninitialized]
>    677 |               if (zerov == prec)
>        |               ^~
> cc1plus: all warnings being treated as errors
> make[2]: *** [Makefile:1122: gimple-range.o] Error 1
>
>    Maciej
>
I can't reproduce it on x86_64-pc-linux-gnu , i presume this is some 
other target.

Eyeballing it, it seems that there was a missed initialization  when the 
builtin code was ported that might show up on a target that defines 
CLZ_DEFINED_VALUE_AT_ZERO  to be non-zero but doesnt always set the 
zerov parameter...  Or maybe it some optimization ordering thing.

Anyway, the following patch has been pushed as an obvious fix to make 
the code match whats in vr-values.

Andrew
commit 425bb53b54aece8ffe8298686c9ba5259ab17b0e
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Oct 26 10:13:58 2020 -0400

    Re: error: ‘EVRP_MODE_DEBUG’ was not declared – was: [PUSHED] Ranger classes.
    
    Initialize zerov to match vr-values.c.
    
            * gimple-range.cc (range_of_builtin_call): Initialize zerov to 0.

Comments

Maciej W. Rozycki Oct. 26, 2020, 7:52 p.m. UTC | #1
On Mon, 26 Oct 2020, Andrew MacLeod wrote:

> >   It is still broken at `-O0', does not build with `--enable-werror-always'
> > (which IMO should be on by default except for releases, just as we do with
> > binutils AFAIK, so as to make sure people do not introduce build problems
> > too easily):
> >
> > .../gcc/gimple-range.cc: In function 'bool
> > range_of_builtin_call(range_query&, irange&, gcall*)':
> > .../gcc/gimple-range.cc:677:15: error: 'zerov' may be used uninitialized
> > [-Werror=maybe-uninitialized]
> >    677 |               if (zerov == prec)
> >        |               ^~
> > cc1plus: all warnings being treated as errors
> > make[2]: *** [Makefile:1122: gimple-range.o] Error 1
> >
> >    Maciej
> >
> I can't reproduce it on x86_64-pc-linux-gnu , i presume this is some other
> target.
> 
> Eyeballing it, it seems that there was a missed initialization  when the
> builtin code was ported that might show up on a target that defines
> CLZ_DEFINED_VALUE_AT_ZERO  to be non-zero but doesnt always set the zerov
> parameter...  Or maybe it some optimization ordering thing.

 Let me see...

$ g++ [...] .../gcc/gimple-range.cc -E -dD | grep CLZ_DEFINED_VALUE_AT_ZERO
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE,VALUE) 0
$

I'm fairly sure this is what the default is.

> Anyway, the following patch has been pushed as an obvious fix to make the code
> match whats in vr-values.

 Thank you!

  Maciej
diff mbox series

Patch

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 267ebad757f..f5c6a1ca620 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -611,7 +611,7 @@  range_of_builtin_call (range_query &query, irange &r, gcall *call)
 
   tree type = gimple_call_return_type (call);
   tree arg;
-  int mini, maxi, zerov, prec;
+  int mini, maxi, zerov = 0, prec;
   scalar_int_mode mode;
 
   switch (func)