On Mon, Nov 03, 2025 at 10:37:01AM +0100, Tobias Burnus wrote:
> gimple_copy missed to unshare_expr its associated trees,
> which leads the the issue below.
>
> All other cases seem to be handled as they either
> use operators (next lines) - or have an associated
> block and are processed above the added code in the
> 'gimple_has_substatements' block.
>
> Any comments, remarks?
LGTM except for formatting.
> + switch (gimple_code (stmt))
> + {
> + case GIMPLE_OMP_ATOMIC_LOAD:
> + {
> + gomp_atomic_load *g = as_a <gomp_atomic_load *> (copy);
> + gimple_omp_atomic_load_set_lhs (g,
> + unshare_expr (gimple_omp_atomic_load_lhs (g)));
> + gimple_omp_atomic_load_set_rhs (g,
> + unshare_expr (gimple_omp_atomic_load_rhs (g)));
I'd write it
tree t = unshare_expr (gimple_omp_atomic_load_lhs (g));
gimple_omp_atomic_load_set_lhs (g, t);
t = unshare_expr (gimple_omp_atomic_load_lhs (g));
gimple_omp_atomic_load_set_rhs (g, t);
and similarly for the store case.
Same number of lines, just function arguments properly aligned.
Ok with those tweaks.
Jakub