https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98281
--- Comment #5 from ishikawa,chiaki <ishikawa at yk dot rim.or.jp> --- (In reply to Martin Sebor from comment #3) > The warning works as designed but the range information it depends on is > less than perfect. As discussed in pr94021 that's a known limitation of the > current range propagation infrastructure. GCC 11 adds an improved range > engine known as the Ranger that's expected to remedy this but it is yet to > be integrated with the sprintf/strlen pass. The argument ranges can be > constrained by using a "narrower" directive such as %hhu. > Thank you for the detailed explanation. It would be great to see this Ranger incorporated into the sprintf/strlen pass. I say this because I found a bug in a popular code which this feature could have found. (The bug was found by the dynamic check done by ASAN-build.) Thank you for continuously developing GCC with these new features. Happy festive season to all.