This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/31236] incorrect output on external symbol address cast as integer used in conditional statement



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]