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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-06-04
                 CC|                            |davidxl at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #3)
> (In reply to Manuel López-Ibáñez from comment #1)
>  
> > My guess is that what is uninitialized is "rw" and some optimization pass
> > messed up the variable names when creating temporaries.
> 
> I'm afraid it's more serious than that, because 'rw = XWINDOW (make_window
> ());' always initializes 'rw'.

Yes you're right. Simplifying further we get:


extern long int make_window (void);
struct vectorlike_header  {  long int size;  };

static  _Bool
PSEUDOVECTORP (long int a)
{
  if (! (((int) a & ~0) == 5))
    return 0;
  else
    {
      struct vectorlike_header *h = (void *) a - 5;
      return (h->size == 4611686018595160064);

    }
}
struct window
  {
    int line_height;
    int pixel_width;
    int pixel_height;
    int column_width;
    int text_cols;
    int internal_border_width;
    int left_fringe_width, right_fringe_width;
};


struct window *
make_frame (_Bool mini_p)
{
  struct window *rw, *mw;
  rw = (struct window *) make_window ();
  if (mini_p)
    {
      long int a = make_window ();
      if (!PSEUDOVECTORP (a)) return rw;
      mw  = (void*) a - 5;
    }
  rw->pixel_width = ((rw->text_cols * (rw->column_width))
                     + (rw->left_fringe_width + (rw->right_fringe_width)) + 2 *
(rw->internal_border_width));
  rw->pixel_height = ((rw->text_cols * (rw->line_height)));
  if (mini_p)
    {
      mw->pixel_height = rw->pixel_height;
    }
  return rw;
}


For this, the uninit pass reports:
[WORKLIST]: add to initial list: mw_1 = PHI <mw_9(D)(9), mw_34(12)>
[CHECK]: examining phi: mw_1 = PHI <mw_9(D)(9), mw_34(12)>

[CHECK] Found def edge 1 in mw_1 = PHI <mw_9(D)(9), mw_34(12)>
[BEFORE SIMPLICATION -- [USE]:
mw_1->pixel_height = _28;
is guarded by :

mini_p_8(D) != 0


[BEFORE NORMALIZATION --[USE]:
mw_1->pixel_height = _28;
is guarded by :

mini_p_8(D) != 0


[AFTER NORMALIZATION -- [USE]:
mw_1->pixel_height = _28;
is guarded by :

mini_p_8(D) != 0


[BEFORE SIMPLICATION -- [DEF]:
mw_1 = PHI <mw_9(D)(9), mw_34(12)>
is guarded by :

mini_p_8(D) != 0 (.AND.)  (.NOT.) _31 != 5 (.AND.) _35 == 4611686018595160064


[BEFORE NORMALIZATION --[DEF]:
mw_1 = PHI <mw_9(D)(9), mw_34(12)>
is guarded by :

mini_p_8(D) != 0 (.AND.)  (.NOT.) _31 != 5 (.AND.) _35 == 4611686018595160064


[AFTER NORMALIZATION -- [DEF]:
mw_1 = PHI <mw_9(D)(9), mw_34(12)>
is guarded by :

_35 == 4611686018595160064 (.AND.)  (.NOT.) _31 != 5 (.AND.) mini_p_8(D) != 0


[CHECK]: Found unguarded use: mw_1->pixel_height = _28;

It seems the computation of the logical guards cannot figure out that if (_35
== 4611686018595160064 (.AND.)  (.NOT.) _31 != 5) is false then the function
terminates and there cannot be uninitialized uses. From the GIMPLE output, it
does not look as if it trivial to know this.

Reply via email to