[Bug middle-end/108459] [OpenMP] ICE during GIMPLE pass: ompexp (segfault) in expand_omp_for_init_counts

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 19 11:08:46 GMT 2023


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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> --- gcc/omp-expand.cc.jj	2023-01-02 09:32:49.399894958 +0100
> +++ gcc/omp-expand.cc	2023-01-19 12:01:05.103410564 +0100
> -	    t = fold_unary (NEGATE_EXPR, itype,
> -			    unshare_expr (fd->loops[i].m1));
> +	    t = fold_build1 (NEGATE_EXPR, itype,
> +			     unshare_expr (fd->loops[i].m1));

Confirmed - fold_unary only hands constants, fold_build1 calls the same but if
it fails (i.e. "tem == NULL"), it calls then
  build1_loc (loc, code, type, op0 PASS_MEM_STAT);

Question: Is the following needed or not? I have not fully followed whether
"diff" and/or "ostep" could be a non-constant or not. At a glance, it looks as
if a variable could be possible.

--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -730,5 +730,4 @@ omp_extract_for_data (gomp_for *for_stmt, struct
omp_for_data *fd,
                    diff = fold_binary (TRUNC_DIV_EXPR, itype,
-                                       fold_unary (NEGATE_EXPR, itype, diff),
-                                       fold_unary (NEGATE_EXPR, itype,
-                                                   ostep));
+                                       build1 (NEGATE_EXPR, itype, diff),
+                                       build1 (NEGATE_EXPR, itype, ostep));
                  else


More information about the Gcc-bugs mailing list