[Bug middle-end/23369] [4.0.x regression] Generates wrong code for funcptr comparison
dave at hiauly1 dot hia dot nrc dot ca
gcc-bugzilla@gcc.gnu.org
Sat Aug 13 21:46:00 GMT 2005
------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca 2005-08-13 21:46 -------
Subject: Re: [4.0.x regression] Generates wrong code for funcptr comparison
> 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 functionpointer!
s.!
> I think we need an assert in do_compare_and_jump to catchinvalid function pointer comparisons.
Yuck. I used Konqueror to add this comment and it totally botched up
the white space ;(
Dave
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23369
More information about the Gcc-bugs
mailing list