boostorg / container

STL-like containers from Boost
http://www.boost.org/libs/container/
Boost Software License 1.0
96 stars 116 forks source link

-Wstringop-overread emitted on simple boost small_vector code with gcc 12.3 #267

Closed kkumar45 closed 3 months ago

kkumar45 commented 4 months ago

With the recent gcc update to 12.3, the class boost::container::small_vector class is showing a compiler warning which is annoying for the developers when they look into the compilation log.

This is acknowledged by gcc development as a bug in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108197

The sample code can be found at: https://godbolt.org/z/TWdPjoobE

I don't see a plan yet from gcc side for releasing the fix. Thus. I wanted to check if it is possible to suppress the warning in Boost temporarily? I did tried using gcc pragma push and pop for ignoring the particular warning, but since the functions are inline, it doesn't suppress it. Looking forward for any further inputs or solution.

kkumar45 commented 3 months ago

Can someone take a look please?

igaztanaga commented 3 months ago

I don't think there's something reasonable that Boost.Container could do, disabling the warning should be something that the user should decide. In any case, those warnings are not emitted in recent boost versions. If you take your godbolt example and change the boost version from 1.80 to the latest versions, the warning goes away. See:

https://godbolt.org/z/KrM88b3bc

kkumar45 commented 3 months ago

@igaztanaga yes looks like it is fixed in newer versions. thanks !