From 73d9bc7652ede8865656df8ac7d31d4c47cfa2bd Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Fri, 27 Sep 2024 09:34:44 -0700 Subject: [PATCH] Fix warnings --- .github/workflows/gcc.yml | 2 +- Src/Particle/AMReX_Particle_mod_K.H | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 32c285185ba..f4ae08f76da 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -86,7 +86,7 @@ jobs: restore-keys: | ccache-${{ github.workflow }}-${{ github.job }}-git- - name: Build & Install - env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -O1 -Wnon-virtual-dtor -Wlogical-op -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wmissing-include-dirs"} + env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -O1 -Wnon-virtual-dtor -Wlogical-op -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wmissing-include-dirs -Wno-null-dereference"} # It's too slow with -O0 run: | export CCACHE_COMPRESS=1 diff --git a/Src/Particle/AMReX_Particle_mod_K.H b/Src/Particle/AMReX_Particle_mod_K.H index 4f07e0db697..a5230c8aee1 100644 --- a/Src/Particle/AMReX_Particle_mod_K.H +++ b/Src/Particle/AMReX_Particle_mod_K.H @@ -14,6 +14,12 @@ void amrex_deposit_cic (P const& p, int nc, amrex::Array4 const& rh amrex::GpuArray const& plo, amrex::GpuArray const& dxi) { +// GCC does not like rdata(comp) +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wno-array-bounds" +#endif + #if (AMREX_SPACEDIM == 1) amrex::Real lx = (p.pos(0) - plo[0]) * dxi[0] + Real(0.5); @@ -101,6 +107,10 @@ void amrex_deposit_cic (P const& p, int nc, amrex::Array4 const& rh #else amrex::Abort("Not implemented."); #endif + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif } template @@ -110,6 +120,12 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4 const& dxi, amrex::GpuArray const& pdxi) { +// GCC does not like rdata(comp) +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wno-array-bounds" +#endif + #if (AMREX_SPACEDIM == 1) amrex::Real factor = (pdxi[0]/dxi[0]); @@ -230,6 +246,10 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4