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

--- Comment #7 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
(quote from the mentioned discussion):
> We then have the call to bar() which could change the value of N to 1. We 
> then hit the second loop and read temp[0] which is uninitialized. The warning 
> for the reduced testcase is correct.

Oops, I thought that GCC is more conservative here. Then, indeed, the reduction
is invalid. Here is another attempt (tested against trunk revision r226223 and
this time it does not contain any calls, but I'm still not sure, whether it's
correct):

typedef struct rtx_def *rtx;
struct recog_data_d
{
  rtx operand;
  char n_dups;
};

rtx *operand_loc;
rtx dup_loc;

struct recog_data_d recog_data;

void elimination_costs_in_insn ()
{
  rtx orig_dup;
  if (recog_data.n_dups)
      orig_dup = dup_loc;
  *operand_loc = 0;
  if (recog_data.n_dups)
      dup_loc = orig_dup;
}

A warning is issued even at -O1. If I remove "rtx operand" field from struct
recog_data_d (or if I change the type of n_dups to int), then it disappears at
-O2 (but still present at -O1).

Reply via email to