https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114627
--- Comment #2 from GCC Commits ---
The master branch has been updated by J?rgen Kvalsvik :
https://gcc.gnu.org/g:a2447556a5405d2cde20afc134b90cd1d199ce04
commit r14-9864-ga2447556a5405d2cde20afc134b90cd1d199ce04
Author: Jørgen Kvalsvik
Date: Mon Apr 8 15:19:55 2024 +0200
Generate constant at start of loop, without UB
Generating the constants used for recording the edges taken for
condition coverage would trigger undefined behavior when an expression
had exactly 64 (== sizeof (1ULL)) conditions, as it would generate the
constant for the next iteration at the end of the loop body, even if there
was never a next iteration. By moving the check and constant generation
to the top of the loop and hoisting the increment flag there is no
opportunity for UB.
PR middle-end/114627
gcc/ChangeLog:
* tree-profile.cc (instrument_decisions): Generate constant
at the start of loop.