Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Sep 27, 2024
1 parent 57a9864 commit 962193f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions Src/Particle/AMReX_Particle_mod_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ void amrex_deposit_cic (P const& p, int nc, amrex::Array4<amrex::Real> const& rh
amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& plo,
amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& dxi)
{
// GCC does not like rdata(comp)
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif

#if (AMREX_SPACEDIM == 1)
amrex::Real lx = (p.pos(0) - plo[0]) * dxi[0] + Real(0.5);

Expand Down Expand Up @@ -101,6 +107,10 @@ void amrex_deposit_cic (P const& p, int nc, amrex::Array4<amrex::Real> const& rh
#else
amrex::Abort("Not implemented.");
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}

template <typename P>
Expand All @@ -110,6 +120,12 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4<amrex::Rea
amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& dxi,
amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& pdxi)
{
// GCC does not like rdata(comp)
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif

#if (AMREX_SPACEDIM == 1)
amrex::Real factor = (pdxi[0]/dxi[0]);

Expand Down Expand Up @@ -230,6 +246,10 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4<amrex::Rea
#else
amrex::Abort("Not implemented.")
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}

}
Expand Down

0 comments on commit 962193f

Please sign in to comment.