This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80202] Spurious warning "array subscript is below array bounds" with if-statement and char to unsigned int conversion


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-03-27
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed for GCC 6, seems to be fixed on trunk.  It's a missed optimization in
VRP:

  <bb 2>:
  _3 = (int) reg_2(D);
  if (_3 <= 0)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 3>:
  _9 = ASSERT_EXPR <_3, _3 <= 0>;
  switch (reg_2(D)) <default: <L4>, case 1 ... 2: <L3>>

we fail to place an assertion for reg_2(D).

OTOH for trunk we simplify the test to if (reg == 0) there and thus
simplify the situation upfront.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]