Hi David, Paul-Antoine!

David: I just noticed a GCC/Analyzer test case regression in context of a
GCC/OpenMP patch that we're about to push, switching a few libgomp entry
points from no argument to one 'unsigned long long' argument.  (We can
still change these, have not yet been in a GCC release.)  Briefly:

On 2026-07-08T14:56:47+0200, Paul-Antoine Arras <[email protected]> wrote:
> --- a/gcc/builtin-types.def
> +++ b/gcc/builtin-types.def

> +DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_INT_ULONGLONG, BT_COMPLEX_INT, 
> BT_ULONGLONG)

> --- a/gcc/omp-builtins.def
> +++ b/gcc/omp-builtins.def

>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_WORKSHARING,
> -               "GOMP_loop_static_worksharing", BT_FN_COMPLEX_INT,
> +               "GOMP_loop_static_worksharing",
> +               BT_FN_COMPLEX_INT_ULONGLONG,
>                 ATTR_CONST_NOTHROW_LEAF_LIST)

> --- a/gcc/omp-expand.cc
> +++ b/gcc/omp-expand.cc
> @@ -5190,42 +5190,6 @@ expand_omp_for_static_nochunk (struct omp_region 
> *region,
> [adjust to pass 'unsigned long long' argument to 
> 'GOMP_loop_static_worksharing' etc.]

The following was unexpected; that patch regresses:

    [-PASS:-]{+FAIL:+} c-c++-common/analyzer/omp-parallel-for-1.c (test for 
excess errors)

... due to:

    [...]/c-c++-common/analyzer/omp-parallel-for-1.c: In function 
'test._omp_fn.0':
    [...]/c-c++-common/analyzer/omp-parallel-for-1.c:16:9: warning: symbol too 
complicated: 'WIDENING({SN 17}, 
(INIT_VAL((*INIT_VAL((*INIT_VAL(.omp_data_i_5(D))).image)).rows)/(realpart_exprCONST_FN_RESULT('__builtin_GOMP_loop_static_worksharing',
 {arg0: CAST(long long unsigned int, 
INIT_VAL((*INIT_VAL((*INIT_VAL(.omp_data_i_5(D))).image)).rows))}))), 
((INIT_VAL((*INIT_VAL((*INIT_VAL(.omp_data_i_5(D))).image)).rows)/(realpart_exprCONST_FN_RESULT('__builtin_GOMP_loop_static_worksharing',
 {arg0: CAST(long long unsigned int, 
INIT_VAL((*INIT_VAL((*INIT_VAL(.omp_data_i_5(D))).image)).rows))})))+(int)1))' 
[-Wanalyzer-symbol-too-complex]
    [...]/c-c++-common/analyzer/omp-parallel-for-1.c:16:9: note: max_depth 19 
exceeds --param=analyzer-max-svalue-depth=18

David, do you have any better recommendation instead of doing what
GCC/Analyzer kind-of suggests?

    +/* { dg-additional-options --param=analyzer-max-svalue-depth=19 } */

(Untested.)

Curiously, I see that regression only for C, but not for C++ compilation
of the 'c-c++-common/analyzer/omp-parallel-for-1.c' test case.  (That
seems suspicious?)


Paul-Antoine:

On 2026-07-08T14:56:47+0200, Paul-Antoine Arras <[email protected]> wrote:
> Subject: [PATCH v3 2/2] openmp: Pass iteration count to static worksharing
>  builtins for OMPT

Thanks!  OK to push, once the issue above is resolved, and:

> --- a/libgomp/libgomp_g.h
> +++ b/libgomp/libgomp_g.h

> -extern __complex__ int GOMP_distribute_static_worksharing (void);
> -extern __complex__ int GOMP_distribute_static_worksharing_start (void);
> +extern _Complex int GOMP_distribute_static_worksharing (unsigned long long);
> +extern _Complex int GOMP_distribute_static_worksharing_start (unsigned long 
> long);
> +extern void GOMP_distribute_static_worksharing_dispatch (void);
> +extern void GOMP_distribute_static_worksharing_end (void);
>  extern void GOMP_distribute_static_worksharing_dispatch (void);
>  extern void GOMP_distribute_static_worksharing_end (void);

It's sufficient to prototype
'GOMP_distribute_static_worksharing_dispatch',
'GOMP_distribute_static_worksharing_end' just once.  ;-)


Grüße
 Thomas

Reply via email to