This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/20229] -Wcast-qual option is easily evaded
- From: "kmk at ssl dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Feb 2005 05:40:25 -0000
- Subject: [Bug c/20229] -Wcast-qual option is easily evaded
- References: <20050227044915.20229.kmk@ssl.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From kmk at ssl dot org 2005-02-27 05:40 -------
Actually, the documentation clearly claims:
"Warn WHENEVER a pointer is cast so as to remove a type qualifier from the
target type."
It does not say:
"Warn whenever a pointer is cast to ANOTHER POINTER in such a way that it
removes a type qualifier from the target type."
Casting a const pointer to any non-pointer object will remove the const
qualifier from the pointer, no matter how you look at it. To not flag this abuse
is not only in obvious contradiction with the documentation, it makes the option
utterly useless for detecting intentionally dangerous behavior by programmers.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20229