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)
This commit is contained in:
parent
94e4661fee
commit
2eca8a9548
1 changed files with 1 additions and 1 deletions
|
@ -167,9 +167,9 @@ option_proposer::build_option_suggestions (const char *prefix)
|
|||
add_misspelling_candidates (m_option_suggestions, option,
|
||||
opt_text);
|
||||
|
||||
struct cl_option optb;
|
||||
for (int j = 0; sanitizer_opts[j].name != NULL; ++j)
|
||||
{
|
||||
struct cl_option optb;
|
||||
/* -fsanitize=all is not valid, only -fno-sanitize=all.
|
||||
So don't register the positive misspelling candidates
|
||||
for it. */
|
||||
|
|
Loading…
Add table
Reference in a new issue