[Bug target/106068] Infinite loop generated with -mcpu=cortex-m7 and -O2

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 23 19:43:10 GMT 2022


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You access an out of bounds for the array dhcp_rx_options_given in the while
statement:

  while((dhcp_rx_options_given[8 + n] != 0) && (n < 2)) {


Swap around the two expressions so you check to make sure n is less than 2
before doing the array access. that is:

  while((n < 2) && (dhcp_rx_options_given[8 + n] != 0)) {


More information about the Gcc-bugs mailing list