]> git.ipfire.org Git - thirdparty/gcc.git/commit
Avoid undefined behaviour in build_option_suggestions
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Fri, 19 Jul 2024 16:44:32 +0000 (12:44 -0400)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Sat, 20 Jul 2024 16:22:41 +0000 (12:22 -0400)
commita551d0330d62d8b5d28c4c9af63bae17afb3bbc4
treec428e8eefade59cb56f626f02f5776559528c68c
parent319b57fb02b52ba9036c00dda36ff28d8274e13d
Avoid undefined behaviour in build_option_suggestions

The inner loop in build_option_suggestions uses OPTION to take the
address of OPTB and use it across iterations, which is undefined
behaviour since OPTB is defined within the loop.  Pull it outside the
loop to make this defined.

gcc/ChangeLog:

* opt-suggestions.cc
(option_proposer::build_option_suggestions): Pull OPTB
definition out of the innermost loop.

(cherry picked from commit e0d997e913f811ecf4b3e10891e6a4aab5b38a31)
gcc/opt-suggestions.cc