This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/23369] [4.0.x regression] Generates wrong code for funcptr comparison
- From: "danglin at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Aug 2005 21:42:26 -0000
- Subject: [Bug middle-end/23369] [4.0.x regression] Generates wrong code for funcptr comparison
- References: <20050813025029.23369.tausq@debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From danglin at gcc dot gnu dot org 2005-08-13 21:42 -------
Bah, while this is probably going to happen for hppa-linux, it'snever going to happen for hppa-hpux. GCC's treatment of functionpointers here is just WRONG.There are a couple of issues. The most serious is the following:We have the following code from __pthread_sigaction in the .i file: if (old == ((__sighandler_t) 1) || old == ((__sighandler_t) 0) || old == ((__sighandler_t) -1)) __sighandler[sig].old = (arch_sighandler_t) act->__sigaction_handler.sa_handler;This is what the above turns into in the tree dump filebug321785.c.t02.original: if ((void (*<T2bd>) (int)) old - 2B > -4B) { __sighandler[sig].old = (void (*<T431>) (int, struct sigcontext *)) act->__sigaction_handler.sa_handler; }I don't believe that the transformation is valid. Also, it not validC to do relational comparisons where one of the operands is a functionpointer. See 6.5.8 (2).do_compare_and_jump doesn't check code before canonicalizing functionpointers. I think we need an assert in do_compare_and_jump to catchinvalid function pointer comparisons.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23369