This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/13038] no diagnostic for null pointer misuse
- From: "falk at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Nov 2003 14:59:48 -0000
- Subject: [Bug c/13038] no diagnostic for null pointer misuse
- References: <20031113142755.13038.fjh@cs.mu.oz.au>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From falk at debian dot org 2003-11-13 14:59 -------
I don't see the error. The cast to int is not an integer constant expression,
but the standard allows an implementation to accept other integer constant
expressions. The value of the cast is implementation defined; gcc defines it to
be 0. So we have an integer constant expression with value 0, which is just
fine to initialize a pointer.
IMHO, at most, a cast from pointer to int used in a constant integer expression
could give a warning, since this is a GCC extension.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13038