https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127708

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |easyhack
   Last reconfirmed|                            |2026-10-09
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
cp_build_c_cast has a complain argument but for the warning it is not checked:
  if (TYPE_PTR_P (type)
      && TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
      /* Casting to an integer of smaller size is an error detected elsewhere. 
*/
      && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (value))
      /* Don't warn about converting any constant.  */
      && !TREE_CONSTANT (value))
    warning_at (loc, OPT_Wint_to_pointer_cast,
                "cast to pointer from integer of different size");


I think just adding `complain & tf_warning` as a check will work.

Reply via email to