Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMReX_FabConv.cpp warning writing 1 byte into a region of size 0 [-Wstringop-overflow=] #2750

Closed
tanweihou opened this issue May 3, 2022 · 5 comments · Fixed by #2767
Closed
Labels

Comments

@tanweihou
Copy link

Dear AMReX developers,
cc: @ax3l
I am a WarpX user in NERSC.
I observed the following warning message when I was building WarpX in Perlmutter.

In function 'void amrex::_pd_btrvout(char*, amrex::Long, amrex::Long)',
    inlined from 'void amrex::_pd_insert_field(amrex::Long, int, char*, int, int, int)' at /build2204-hdf5/_deps/fetchedamrex-src/Src/Base/AMReX_FabConv.cpp:462:12,
    inlined from 'void amrex::PD_fconvert(void*, const void*, amrex::Long, int, const Long*, const int*, const Long*, const int*, int, int, int)' at /build2204-hdf5/_deps/fetchedamrex-src/Src/Base/AMReX_FabConv.cpp:743:17:
/build2204-hdf5/_deps/fetchedamrex-src/Src/Base/AMReX_FabConv.cpp:393:7: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  393 |             *p2 = tmp;
      |       ^
/build2204-hdf5/_deps/fetchedamrex-src/Src/Base/AMReX_FabConv.cpp: In function 'void amrex::PD_fconvert(void*, const void*, amrex::Long, int, const Long*, const int*, const Long*, const int*, int, int, int)':
/build2204-hdf5/_deps/fetchedamrex-src/Src/Base/AMReX_FabConv.cpp:612:6: note: at offset [9, 1073741822] into destination object 'in_long' of size 8
  612 | PD_fconvert (void*       out,

Here's the list of modules that I use in Perlmutter.

Currently Loaded Modules:
  1) craype-x86-milan                      10) craype/2.7.15
  2) libfabric/1.11.0.4.114                11) cray-dsmml/0.2.2
  3) craype-network-ofi                    12) cray-mpich/8.1.15
  4) perftools-base/22.04.0                13) cray-libsci/21.08.1.2
  5) xpmem/2.3.2-2.2_7.5__g93dd7ee.shasta  14) PrgEnv-gnu/8.3.3
  6) xalt/2.10.2                           15) Nsight-Compute/2022.1.1
  7) darshan/3.3.1                         16) Nsight-Systems/2022.2.1
  8) cmake/3.22.0                          17) cudatoolkit/11.5
  9) gcc/11.2.0                            18) cray-hdf5-parallel/1.12.1.1

Thank you.

@Thierry992
Copy link
Contributor

Have the same issue on Perlmutter

@WeiqunZhang
Copy link
Member

I can reproduce the warnings on Perlmutter when compiling with cmake. However, there are no such warnings with gnu make (with -Wall -Wstringop-overflow). The difference seems to be that in gnu make nvcc -ccbin=g++ is used, whereas in cmake nvcc -ccbin=CC is used.

@WeiqunZhang
Copy link
Member

It is due to that the CC wrapper adds -march=znver3 to g++.

@WeiqunZhang
Copy link
Member

-O3 -march=znver3 produces the warnings, but -O2 -march=znver3 does not.

@WeiqunZhang
Copy link
Member

The warnings are false positive, but we can fix them.

WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this issue May 12, 2022
On Perlmutter, `g++ -O3 -march=znver3` produces lots of stringop-overflow warnings in
FabConv.  These warnings are false positive because the compiler does not know
sizeof(amrex::Real) is either 4 or 8.  This commit fixes the warnings.

Close AMReX-Codes#2750
WeiqunZhang added a commit that referenced this issue May 12, 2022
On Perlmutter, `g++ -O3 -march=znver3` produces lots of stringop-overflow warnings in
FabConv.  These warnings are false positive because the compiler does not know
sizeof(amrex::Real) is either 4 or 8.  This commit fixes the warnings.

Close #2750
kngott pushed a commit to kngott/amrex that referenced this issue May 19, 2022
On Perlmutter, `g++ -O3 -march=znver3` produces lots of stringop-overflow warnings in
FabConv.  These warnings are false positive because the compiler does not know
sizeof(amrex::Real) is either 4 or 8.  This commit fixes the warnings.

Close AMReX-Codes#2750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants