[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug middle-end/47307] Uninitialized in this function: warning for initialized, no warning for unini
From:       "manu at gcc dot gnu.org" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2017-12-31 16:26:59
Message-ID: bug-47307-4-4Ic4JGEWnR () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47307

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #1)
> Move to middle end. From the dump:
> 
> readmo ()
> {
>   integer(kind=4) lopt[15];
>   real(kind=4) convrt;
>   [...]
>   iflag = 0;
>   [...]
>     if (lopt[((integer(kind=8)) j + (integer(kind=8)) i * 3) + -4] < 0)
>       {
>         convrt = 1.0e+0;
>         iflag = 1;
>       }
>   if (iflag != 0)
>     ... access convrt ...
> 
> Thus, lopt is never set, but not warned for. But convrt is only accessed if
> it is set. However, the middle-end (with optimization) only has
>   warning: 'convrt' may be used uninitialized in this function


lopt looks like an array, and Wuninitialized does not work in arrays in general
(PR42561 and others)

The uninit pass dump should give more details of what went wrong, but I think
the predicate analysis of the pass does not work with a pattern like:

if(conditionA)
  initialize convrt
  set conditionB to true

if(conditionB)
  use convrt

unless in some very specific cases where the conditions can be merged as:

if(conditionA)
  initialize convrt
  use convrt


There are some PRs linked form PR24639 with the words "predicate analysis". I
remember that at least one of them was hitting this exact same case.=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic