This is the mail archive of the gcc-patches@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] |
This patch fixes PR44328, and provides a basic regression test for it. The bug was caused by an underflow occurring in tree-switch-conversion.c, when the lower bound for the valid switch range was subtracted from the minimum value for the enum, thereby causing values beyond the enum's max value to be possible. Without this change, tree-vrp.c was optimising away the range check because it seemed unnecessary based on the max value it had for the index. Note that the bug does not show on trunk unless you use -fstrict-enums. My testing has been done on 4.4 branch and 4.5 branch for ARM. I would appreciate some feedback on how to make the test better (e.g. where to put it, should it be executed too?), and advice on whether the patch should be aimed at 4.5 or trunk initially. Cheers, Ian 2010-08-12 Ian Bolton <ian.bolton@arm.com> * tree-switch-conversion.c (gen_inbound_check): Ensure that the type for the conditional has wide enough range. * testsuite/gcc.target/arm/pr44328.C: New test.
Attachment:
pr44328.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |