danielaparker / jsoncons

A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
https://danielaparker.github.io/jsoncons
Other
726 stars 164 forks source link

Built in test does not compile #411

Closed AlainLich closed 1 year ago

AlainLich commented 1 year ago

Describe the bug Just installed from Github, tried the default make, which builds the tests. Several lines/functions in msgpack_parser.hpp do not compile. Using:

commit 73c85182dc56d4441cdcd97255b23aa6f15b9121 (HEAD -> al_checks, origin/master, origin/HEAD, master)
Merge: 179b8d08e 136fe6be4
Author: Daniel Parker <danielaparker@yahoo.com>
Date:   Thu Dec 8 23:07:31 2022 -0500

Some test did not compile, for example (full compiler output in attachment):

jsoncons/include/jsoncons_ext/msgpack/msgpack_parser.hpp:282:29: 
note: at offset 4 into destination object 'buf' of size 4
  282 |                     uint8_t buf[sizeof(float)];

Enumerate the steps to reproduce the bug

Include a small, self-contained example if possible

What compiler, architecture, and operating system?

g++ --version
g++ (Debian 12.2.0-10) 12.2.0

With debian built under Docker:
Get:1 http://deb.debian.org/debian sid InRelease [167 kB]
Get:2 http://deb.debian.org/debian sid/main amd64 Packages [9419 kB]

Architecture:
model name      : Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz

What jsoncons library version?

economicseries commented 1 year ago

Could you post all compiler output for msgpack_parser.hpp?

Thanks, Daniel

AlainLich commented 1 year ago

JsonCons.compile.txt

Hi, in attachment the output from make, I hope that this is what you are looking for. Alain

economicseries commented 1 year ago

Thanks!

economicseries commented 1 year ago

After investigation, I think this is a spurious stringop-overflow warning by an overeager compiler. I can't replicate it in any of my test environments, but from your compiler output it's clear where it's occurring. I've rewritten the code to hopefully work around the issue, could you try rebuilding the tests from master?

Thanks, Daniel

AlainLich commented 1 year ago

Hi Daniel,

thanks for you quick response. With commit 928fcca228face5c59fe616d4f4f37596e82804 everything compiles OK in my configuration. (Restarted with new empty build directory, selected native compiler and "Release" build.)

I have put the test results in attachment, in case this is helpful, Regards, Alain jsonTestFail-Feb17.txt

danielaparker commented 1 year ago

Fix is in 0.170.0