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

compile error with gcc 11.3.0 #473

Closed
romange opened this issue Dec 7, 2023 · 8 comments · Fixed by microsoft/vcpkg#36163
Closed

compile error with gcc 11.3.0 #473

romange opened this issue Dec 7, 2023 · 8 comments · Fixed by microsoft/vcpkg#36163

Comments

@romange
Copy link
Contributor

romange commented Dec 7, 2023

Describe the bug
when running make on v0.172.1 I get compile error

In member function ‘void jsoncons::basic_bigint<Allocator>::resize(jsoncons::basic_bigint<Allocator>::size_type) [with Allocator = std::allocator<unsigned char>]’,
    inlined from ‘jsoncons::basic_bigint<Allocator>& jsoncons::basic_bigint<Allocator>::operator>>=(uint64_t) [with Allocator = std::allocator<unsigned char>]’ at /home/roman/projects/jsoncons/include/jsoncons/bigint.hpp:773:19,
    inlined from ‘void jsoncons::basic_bigint<Allocator>::unnormalize(jsoncons::basic_bigint<Allocator>&, int, int) const [with Allocator = std::allocator<unsigned char>]’ at /home/roman/projects/jsoncons/include/jsoncons/bigint.hpp:1561:17,
    inlined from ‘void jsoncons::basic_bigint<Allocator>::divide(jsoncons::basic_bigint<Allocator>, jsoncons::basic_bigint<Allocator>&, jsoncons::basic_bigint<Allocator>&, bool) const [with Allocator = std::allocator<unsigned char>]’ at /home/roman/projects/jsoncons/include/jsoncons/bigint.hpp:1425:24:
/home/roman/projects/jsoncons/include/jsoncons/bigint.hpp:516:18: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ specified size between 18446744073441116168 and 18446744073709551615 may exceed maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
  516 |             a[i] = 0;

make succeeds

Enumerate the steps to reproduce the bug

git checkout v0.172.1
mkdir build
cmake ..
make -j4

Include a small, self-contained example if possible

What compiler, architecture, and operating system?

  • Compiler: gcc 11.3
  • Architecture (e.g. x86, x64) _x64
  • Operating system: Linux Mint 21

What jsoncons library version?

  • [x ] Latest release 0.172.1
@romange romange added the Bug label Dec 7, 2023
@danielaparker
Copy link
Owner

Can you check if you still see this with the code on master? Thanks.

@danielaparker
Copy link
Owner

I believe this has been fixed.

@romange
Copy link
Contributor Author

romange commented Dec 14, 2023

It has not been @danielaparker

image

@danielaparker
Copy link
Owner

Can you post this output as you did before so I can see the entire line?

Thanks,
Daniel

@romange
Copy link
Contributor Author

romange commented Dec 14, 2023

this is how I do it (from jsoncons project root):

on my machine:

docker run -it -v$(pwd):/src --rm ghcr.io/rikorose/gcc-cmake

in the container:

cd /src
mkdir build && cd build && cmake ..
make -j

the error:

In file included from /src/include/jsoncons/json_encoder.hpp:20,
                 from /src/include/jsoncons/pretty_print.hpp:19,
                 from /src/include/jsoncons/basic_json.hpp:29,
                 from /src/include/jsoncons/json.hpp:10,
                 from /src/test/corelib/src/json_type_traits_chrono_tests.cpp:5:
In member function 'void jsoncons::basic_bigint<Allocator>::resize(size_type) [with Allocator = std::allocator<unsigned char>]',
    inlined from 'jsoncons::basic_bigint<Allocator>& jsoncons::basic_bigint<Allocator>::operator>>=(uint64_t) [with Allocator = std::allocator<unsigned char>]' at /src/include/jsoncons/bigint.hpp:773:19,
    inlined from 'void jsoncons::basic_bigint<Allocator>::unnormalize(jsoncons::basic_bigint<Allocator>&, int, int) const [with Allocator = std::allocator<unsigned char>]' at /src/include/jsoncons/bigint.hpp:1561:17,
    inlined from 'void jsoncons::basic_bigint<Allocator>::divide(jsoncons::basic_bigint<Allocator>, jsoncons::basic_bigint<Allocator>&, jsoncons::basic_bigint<Allocator>&, bool) const [with Allocator = std::allocator<unsigned char>]' at /src/include/jsoncons/bigint.hpp:1425:24:
/src/include/jsoncons/bigint.hpp:516:18: error: 'void* __builtin_memset(void*, int, long unsigned int)' specified bound between 18446744073441116168 and 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
  516 |             a[i] = 0;
      |             ~~~~~^~~
cc1plus: all warnings being treated as errors
make[2]: *** [test/CMakeFiles/unit_tests.dir/build.make:1490: test/CMakeFiles/unit_tests.dir/corelib/src/json_type_traits_chrono_tests.cpp.o] Error 1

@danielaparker
Copy link
Owner

@romange, I can't replicate this in my test environments, so I'm left with trying to conjecture what might cause your compiler to think there could be an issue. I've made a few changes on master, and would appreciate it if you could try running the tests for the code on master.

@romange
Copy link
Contributor Author

romange commented Dec 18, 2023

Just checked it. The issue has disappeared.

@danielaparker
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants