This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31236] incorrect output on external symbol address cast as integer used in conditional statement
- From: "sh-list at ssc-studios dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2007 00:07:31 -0000
- Subject: [Bug c/31236] incorrect output on external symbol address cast as integer used in conditional statement
- References: <bug-31236-14260@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from sh-list at ssc-studios dot com 2007-03-17 00:07 -------
I don't think this behavior is part of the C or C++ standard.
nor is __attribute__ (( weak ))
this behavior of gcc seems to be undocumented.
I don't see how usefull it is to have gcc assume pointers to functions to be
non-null in conditionals as when a programmer checks for the pointer to be null
or not in a conditional statement that should hint the compiler as it might be
null (unless the function is within this translation unit).
proposed fix: extern should cause the compiler to assume NOTHING about the
location of the symbol by default.
other reason for bug: embedded systems can have symbols legally starting at
address 0, including a function (the reset interrupt handler for example)
--
sh-list at ssc-studios dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31236