https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102969
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Host|powerpc64-linux-gnu, | |powerpc64le-linux-gnu | Last reconfirmed| |2021-10-27 Component|other |tree-optimization Target Milestone|--- |12.0 Target|powerpc64-linux-gnu, |powerpc64{,le}-linux-gnu, |powerpc64le-linux-gnu |aarch64-linux-gnu Keywords| |diagnostic Build|powerpc64-linux-gnu, | |powerpc64le-linux-gnu | --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. I noticed this too. I debugged it a little bit too. The reason why it shows up in C++98 only is because C++98 does the size check slightly different and does not throw an exception in the case of an overflow. Also You need all 3 checks in the code to get the warning in the first place, that is: ptrdiff_t r_dmin_dmax = SR (DIFF_MIN, DIFF_MAX); T (S (1), new int16_t[r_dmin_dmax]); T (S (2), new int16_t[r_dmin_dmax + 1]); T (S (9), new int16_t[r_dmin_dmax * 2 + 1]); Have just the one which warns does not cause a warning. I didn't look further than that.