public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/28584] Cast to pointer from integer of different size Date: Sat, 20 Feb 2010 18:19:00 -0000 [thread overview] Message-ID: <20100220181923.31767.qmail@sourceware.org> (raw) In-Reply-To: <bug-28584-13051@http.gcc.gnu.org/bugzilla/> ------- Comment #2 from manu at gcc dot gnu dot org 2010-02-20 18:19 ------- Jason, do we want this? It seems trivial: Index: gcc/cp/typeck.c =================================================================== --- gcc/cp/typeck.c (revision 156923) +++ gcc/cp/typeck.c (working copy) @@ -6260,10 +6260,20 @@ cp_build_c_cast (tree type, tree expr, t if (complain & tf_error) error ("invalid cast to function type %qT", type); return error_mark_node; } + + if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE + && 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"); + /* A C-style cast can be a const_cast. */ result = build_const_cast_1 (type, value, /*complain=*/false, &valid_p); if (valid_p) return result; -- manu at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at redhat dot com, | |manu at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28584
next prev parent reply other threads:[~2010-02-20 18:19 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-08-03 13:57 [Bug c++/28584] New: Cast to pointer from integer of different size [gcc 4.0.x and 4.1.x on x86_64] denis dot charland at imi dot cnrc-nrc dot gc dot ca 2009-12-08 20:32 ` [Bug c++/28584] Cast to pointer from integer of different size redi at gcc dot gnu dot org 2010-02-20 18:19 ` manu at gcc dot gnu dot org [this message] 2010-02-20 20:15 ` jason at redhat dot com 2010-02-22 19:05 ` manu at gcc dot gnu dot org 2010-02-22 19:50 ` manu at gcc dot gnu dot org 2010-04-09 7:50 ` manu at gcc dot gnu dot org 2010-04-09 7:53 ` manu at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100220181923.31767.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).