------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca 2005-08-15 13:46 ------- Subject: Re: [4.0/4.1 regression] build_range_check generates wrong code for funcptr comparison
> Do I understand correctly that there are two distinct problems: > > 1) gcc should not be canonicalizing constants casted as function pointers I think it has to. GCC has no way of knowing whether the constant is a "real" function pointer or not. > 2) gcc should not generate relational comparisons against function pointers Relational comparisons against function pointers are not allowed in C. However, what GCC does internally is a different matter as it knows whether function pointers need to be canonicalized or not. > it seems from my quick tests that #1 is not affected by build_range_test (i.e. > something else is wrong). I have a patch to build_range_check that fixes the problem in the PR. I'll submit it this evening. I do have a concern that as GCC's optimizations improve we seem to be encountering more and more issues with respect to the handling of function pointers. The problem in the PR is latent in 3.3 and 3.4. I'm not sure why it doesn't happen there. Dave -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23369