This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36902] Array bound warning with dead code after optimization
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2008 10:50:14 -0000
- Subject: [Bug middle-end/36902] Array bound warning with dead code after optimization
- References: <bug-36902-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #23 from manu at gcc dot gnu dot org 2008-08-25 10:50 -------
(In reply to comment #22)
> there is currently no good way to detect if a block is dead during the VRP
> pass, as the VRP information is used for *determining* wether or not a block is
> dead.
I think in this case it is.
simplify_switch_using_ranges is called before the warning occurs. However, it
doesn't handle the case where the switch index is an integer constant! So it
just doesn't do anything. I think this is a missed optimization, it should
simplify the switch.
> Is there a general warning-queuing implementation that I could make use of or
> is there some other warning that does that already? Iirc the "is used/ might be
> used uninitialized" type of warnings do not use something like that.
No, we don't have that but "is used/ may be used" does detect whether the
current BB is always executed or not. That would be an improvement in my
opinion. Not in this case anyway because as I said above, in this case we could
do perfect.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36902