[Bug testsuite/85888] [9 Regression] New test case c-c++-common/attr-nonstring-6.c from r260541 fails with excess errors

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 23 14:31:00 GMT 2018


Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-05-23
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with a powerpc64le-linux cross-compiler.  Recent test results
reported for no other targets doesn't show the failures.

With the powerpc64le-linux cross the warning is issued at a different stage of
expansion of the built-in than on other targets, and with the strncmp() bound
represented by a different tree node: during expand_call() vs.
expand_builtin_strncmp(), respectively, and  with MIN_EXPR (NOP_EXPR (sizetype,
SSA_NAME (n_6)), 3) and SSA_NAME, respectively.

The bound is passed to the get_size_range() function to try to determine its
range.  For SSA_NAME arguments the function uses get_range_info() to determine
the range, and for all others it simply uses the range of the type of the
expression.  So powerpc64le-linux ends up with the full range of the bound's
type (i.e., [0, SIZE_MAX]), while on other targets it extracts the range [0,
3].  The wider range is what triggers the warning (as expected).

More information about the Gcc-bugs mailing list