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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I've reduced the test-case which started to fail with the commit:

$ cat riscv.cc
enum machine_mode {};
enum rtx_code { SUBREG, PLUS };
bool fn1(int);
int fn2(machine_mode);
struct A {
  int offset;
};
machine_mode a;
rtx_code b;
bool c, d;
bool fn3(A *p1) {
  switch (b) {
  case SUBREG:
    d = fn2(a);
    return d;
  case PLUS:
    c = fn2(a);
    return c && fn1(p1->offset);
  }
  return true;
}
void fn4() {
  A e;
  fn3(&e);
}

$ g++ -O2 riscv.cc -Werror=maybe-uninitialized -c
riscv.cc: In function ‘void fn4()’:
riscv.cc:18:20: error: ‘e.A::offset’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
   18 |     return c && fn1(p1->offset);
      |                 ~~~^~~~~~~~~~~~
cc1plus: some warnings being treated as errors

Which is a valid warning if I'm correct.
For the bootstrap, I would recommend to set addr to zero. Let me prepare a
patch.

Reply via email to