]> 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 11:53:23 +0000 (07:53 -0400)
commite0d997e913f811ecf4b3e10891e6a4aab5b38a31
tree07dcbc73ac9d424f54f7f5a5539f47473876f997
parent56f824cc206ff00d466aaeb11211d8005c4668bc
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.
gcc/opt-suggestions.cc