[Bug sanitizer/81601] [7/8 Regression] incorrect Warray-bounds warning with -fsanitize

aldyh at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 17 19:16:00 GMT 2018


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

--- Comment #10 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Further reduced testcase.  Can be reproduced with -O2 -Wall.

struct tcp_sock {
  int   chrono_stat[3];
  unsigned char chrono_type:2;
};

void tcp_chrono_set(struct tcp_sock *tp)
{
  int type = 1;
  if (type > tp->chrono_type)
    {
      if (tp->chrono_type > 0)
        tp->chrono_stat[tp->chrono_type - 1] = 1234;
    }
}


More information about the Gcc-bugs mailing list