lcn2 / calc

C-style arbitrary precision calculator
http://www.isthe.com/chongo/tech/comp/calc/index.html
Other
358 stars 51 forks source link

error: buildtin memcpy forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' #20

Closed dbrandesky closed 3 years ago

dbrandesky commented 3 years ago

Just checked out the latest build, 2.12.17.5, ran 'make clean' then 'make all', but received the following errors:

~/git/calc$ make all make[1]: Entering directory '/home/dan/git/calc' make[1]: Leaving directory '/home/dan/git/calc' make[1]: Entering directory '/home/dan/git/calc' gcc -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC longbits.c -c rm -f longbits gcc -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC longbits.o -o longbits forming longbits.h longbits.h formed forming align32.h align32.h formed gcc -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC endian.c -c rm -f endian gcc -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC endian.o -o endian forming endian_calc.h endian_calc.h formed forming fposval.h fposval.h formed gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o addop.o addop.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o assocfunc.o assocfunc.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o blkcpy.o blkcpy.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o block.o block.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o byteswap.o byteswap.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o calcerr.o calcerr.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o codegen.o codegen.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o comfunc.o comfunc.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o commath.o commath.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o config.o config.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o const.o const.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -c -o custom.o custom.c gcc -Werror -Wextra -pedantic -DCALC_SRC -DCUSTOM -Wall -march=native -fPIC -O3 -g3 -Wno-error=long-long -Wno-long-long -c file.c In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'set_open_pos' at file.c:1638:8, inlined from 'setloc' at file.c:1700:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'setloc': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'fseekid' at file.c:1585:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'fseekid': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'fseekid' at file.c:1602:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'fseekid': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'fseekid' at file.c:1569:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'fseekid': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'fsearch' at file.c:2653:8: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'fsearch': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'frsearch' at file.c:2812:8: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'frsearch': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'frsearch' at file.c:2780:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'frsearch': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ In file included from /usr/include/string.h:495, from alloc.h:42, from zmath.h:39, from qmath.h:32, from cmath.h:32, from value.h:33, from calc.h:33, from file.c:39: In function 'memcpy', inlined from 'z2filepos' at file.c:1419:2, inlined from 'frsearch' at file.c:2768:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [9, 16] is out of the bounds [0, 8] of object 'pos' with type 'FULL' {aka 'long unsigned int'} [-Werror=array-bounds] 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file.c: In function 'frsearch': file.c:1403:7: note: 'pos' declared here 1403 | FULL pos; /* zpos as a FULL */ | ^~~ cc1: all warnings being treated as errors make[1]: *** [Makefile.ship:2371: file.o] Error 1 make[1]: Leaving directory '/home/dan/git/calc' make: *** [Makefile:206: all] Error 2

lcn2 commented 3 years ago

Please, using the top of the master branch (it won't fix your issue, but it will help us help you).

Please reply with the the attached of debug.out:

make debug > debug.out 2>&1

dbrandesky commented 3 years ago

Please, using the top of the master branch (it won't fix your issue, but it will help us help you).

Please reply with the the attached of debug.out:

make debug > debug.out 2>&1

Thanks for the reply!

I pasted the output into pastebin, it's fairly long. https://pastebin.com/Vw91frkY

lcn2 commented 3 years ago

Thanks for the pastebin file, we will look it over.

In the mean time, please describe your compile / system environment as best as you can. In particular:

* the type and version of system you were using
* the type and version of compiler you were using
dbrandesky commented 3 years ago

Thanks for the pastebin file, we will look it over.

In the mean time, please describe your compile / system environment as best as you can. In particular:

* the type and version of system you were using
* the type and version of compiler you were using

I'm using GNU Make 4.2.1 Built for x86_64-pc-linux-gnu on Ubuntu 20.04. Let me know if you need additional details.

lcn2 commented 3 years ago

We have some improved news: We have now reproduced your issue. In the mean time, please send us the output of these commands:

uname -a gcc -v

Thanks.

dbrandesky commented 3 years ago

We have some improved news: We have now reproduced your issue. In the mean time, please send us the output of these commands:

uname -a gcc -v

Thanks.

Excellent!

uname -a Linux fait100063l-2 5.4.0-62-generic #70-Ubuntu SMP Tue Jan 12 12:45:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)

lcn2 commented 3 years ago

Thanks for that additional info.

FYI: We are debugging with gcc/9.3.1 and gcc/10.2.1 under Red Hat Enterprise Linux Server release 7.9 (Maipo), which shows the same problem that you uncovered using gcc/9.3.0. We don't think this is a OS issue, so the Ubuntu 20.04 vs. RHEL 7.9 difference should NOT matter. We are both testing under 64-bit Intel(R) architectures.

FYI: Our gcc/9.3.1 reports:

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/global/gcc/gcc-9.3.1/bin/../libexec/gcc/x86_64-redhat-linux/9/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)

lcn2 commented 3 years ago

Update: While we seemed to have fixed the compile issue in file.c, we see there is also an compiler issue with file.c, input.c, version.c, and calc.c.

Do these each compiles issue compiler warnings for you as well?

make file.o make input.o make version.o make calc.o

lcn2 commented 3 years ago

Hello,

Please try compiling the master branch. For us, the master branch compiles cleanly without any errors or warnings, with gcc/9.3.1 and gcc/10.2.1.

Please report any compiler errors or warnings.

Thanks for taking the time to report this issue to us.

dbrandesky commented 3 years ago

I was able to make, check, and install Calc today using the latest master; thank you very much! I look forward to checking it out and using it now.