https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97898

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:9438c98dca4397b0c3b8bed985a6d434d5fb76fa

commit r16-7079-g9438c98dca4397b0c3b8bed985a6d434d5fb76fa
Author: Andrew Pinski <[email protected]>
Date:   Fri Jan 23 17:06:14 2026 -0800

    openmp: Fix omp for static schedule loop with pointers [PR97898]

    When r0-122699-gea3a0fdefa353d was done to fix up handling of
    gimple statements in openmp expand, there was one spot which did:
    ```
    if (DECL_P (vback) && TREE_ADDRESSABLE (vback))
      t = force_gimple_operand_gsi (&gsi t, true
    ```
    While other locations did:
    ```
    t = force_gimple_operand_gsi (&gsi t, DECL_P (vback) && TREE_ADDRESSABLE
(vback) ...
    ```

    This fixes that one location which fixes up openmp for static scheduling
with
    a pointer as the induction variable.
    Basically with a pointer type, we need to convert the rhs of the
POINTER_PLUS
    to be the same as size_type and with that conversion, the POINTER_PLUS
becomes
    an invalid gimple.

    I don't think this is a regression but this is a small fix up which has now
    shown up twice.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR middle-end/97898

    gcc/ChangeLog:

            * omp-expand.cc (expand_omp_for_static_chunk): Don't
            conditionalize the call to force_gimple_operand_gsi on
DECL_P/TREE_ADDRESSABLE
            but rather pass that as the 3rd argument.

    gcc/testsuite/ChangeLog:

            * c-c++-common/gomp/pr97898-1.c: New test.

    Signed-off-by: Andrew Pinski <[email protected]>

Reply via email to