openmp: Fix up OpenMP expansion of collapsed loops [PR120564]

Most of gimple_build_cond_empty callers call just build2 to prepare
condition which is put into GIMPLE_COND, but this one spot has been
using incorrectly fold_build2.  Now the arguments of the *build2 were
already gimplified, but the folding of some conditions can turn say
unsigned_var > INT_MAX into (int) unsigned_var < 0 etc. and thus
turn the condition into something invalid in gimple, because we only
try to regimplify the operands if they refer to some decl which needs
to be regimplified (has DECL_VALUE_EXPR on it).

Fixed by also using build2 instead of fold_build2.

2025-11-25  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/120564
	* omp-expand.cc (extract_omp_for_update_vars): Use build2 instead of
	fold_build2 to build argument for gimple_build_cond_empty.

	* c-c++-common/gomp/pr120564.c: New test.

(cherry picked from commit a117fd63e423fb60f5e5f07125a11c7183109bf2)
2 files changed