From: Thomas Schwinge Date: Tue, 25 Oct 2022 07:45:31 +0000 (+0200) Subject: Resolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e32d1582a137d5f34248fdd3e93d35a798f5221;p=thirdparty%2Fgcc.git Resolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses' ..., introduced in og12 commit 55722a87dd223149dcd41ca9c8eba16ad5b3eddc "openmp: fix max_vf setting for amdgcn offloading": In file included from [...]/source-gcc/gcc/coretypes.h:482, from [...]/source-gcc/gcc/omp-low.cc:27: [...]/source-gcc/gcc/poly-int.h: In instantiation of ‘typename if_nonpoly::type maybe_lt(const Ca&, const poly_int_pod&) [with unsigned int N = 1; Ca = int; Cb = long unsigned int; typename if_nonpoly::type = bool]’: [...]/source-gcc/gcc/poly-int.h:1510:7: required from ‘poly_int::type>::type> ordered_max(const poly_int_pod&, const Cb&) [with unsigned int N = 1; Ca = long unsigned int; Cb = int; typename poly_result::type>::type = long unsigned int; typename if_nonpoly::type = int]’ [...]/source-gcc/gcc/omp-low.cc:5180:33: required from here [...]/source-gcc/gcc/poly-int.h:1384:12: error: comparison of integer expressions of different signedness: ‘const int’ and ‘const long unsigned int’ [-Werror=sign-compare] 1384 | return a < b.coeffs[0]; | ~~^~~~~~~~~~~ [...]/source-gcc/gcc/poly-int.h: In instantiation of ‘typename if_nonpoly::type maybe_lt(const poly_int_pod&, const Cb&) [with unsigned int N = 1; Ca = long unsigned int; Cb = int; typename if_nonpoly::type = bool]’: [...]/source-gcc/gcc/poly-int.h:1515:2: required from ‘poly_int::type>::type> ordered_max(const poly_int_pod&, const Cb&) [with unsigned int N = 1; Ca = long unsigned int; Cb = int; typename poly_result::type>::type = long unsigned int; typename if_nonpoly::type = int]’ [...]/source-gcc/gcc/omp-low.cc:5180:33: required from here [...]/source-gcc/gcc/poly-int.h:1373:22: error: comparison of integer expressions of different signedness: ‘const long unsigned int’ and ‘const int’ [-Werror=sign-compare] 1373 | return a.coeffs[0] < b; | ~~~~~~~~~~~~^~~ gcc/ * omp-low.cc (lower_rec_simd_input_clauses): For 'ordered_max', cast 'omp_max_simt_vf ()', 'omp_max_simd_vf ()' to 'unsigned'. --- diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index b5b2681b6541..002f91d930a9 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -5177,8 +5177,8 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx, if (omp_maybe_offloaded_ctx (ctx)) { if (sctx->is_simt) - sctx->max_vf = ordered_max (sctx->max_vf, omp_max_simt_vf ()); - sctx->max_vf = ordered_max (sctx->max_vf, omp_max_simd_vf ()); + sctx->max_vf = ordered_max (sctx->max_vf, (unsigned) omp_max_simt_vf ()); + sctx->max_vf = ordered_max (sctx->max_vf, (unsigned) omp_max_simd_vf ()); } if (maybe_gt (sctx->max_vf, 1U)) {