From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 7816E3857C63; Fri, 28 Oct 2022 07:52:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7816E3857C63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666943554; bh=atr54QKQl100AJN5A9FhlQgnEi0YM+eRYVlRaZLQ2L8=; h=From:To:Subject:Date:From; b=Uux1LxfhoO+r7fDqmAOK27+voN37KmL9GVfUr1mOpJ/afwYZDIJ2YW1VMTNA4QlIy efrLFLAGKSyHf8+IncJLKyxclwOO8v6kQWqggdFmATR2gHcuoJ+5YaymfbdOlf8Dz2 tvfrIcPC/2hmT1wy7ioC+vSgAOtrk0aSFnUuE2KA= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] Resolve '-Wsign-compare' issue in 'gcc/omp-low.cc:lower_rec_simd_input_clauses' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: 5f4d2a15403d7231d7be673a9d633c0b4a22e19c X-Git-Newrev: 4e32d1582a137d5f34248fdd3e93d35a798f5221 Message-Id: <20221028075234.7816E3857C63@sourceware.org> Date: Fri, 28 Oct 2022 07:52:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4e32d1582a137d5f34248fdd3e93d35a798f5221 commit 4e32d1582a137d5f34248fdd3e93d35a798f5221 Author: Thomas Schwinge Date: Tue Oct 25 09:45:31 2022 +0200 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: --- gcc/omp-low.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index b5b2681b654..002f91d930a 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)) {