diff options
author | Roger Sayle <roger@eyesopen.com> | 2004-10-11 16:11:35 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2004-10-11 16:11:35 +0000 |
commit | eb172681f75b5ff4196bf4e670826a7f442eb90c (patch) | |
tree | fe3cbc69dccdda01ae79f78ed7e383ab4f17b65e /gcc/testsuite/gcc.dg/switch-4.c | |
parent | 539ed333f6e84709a56649827401a1b1b6ceb374 (diff) | |
download | gcc-eb172681f75b5ff4196bf4e670826a7f442eb90c.zip gcc-eb172681f75b5ff4196bf4e670826a7f442eb90c.tar.gz gcc-eb172681f75b5ff4196bf4e670826a7f442eb90c.tar.bz2 |
re PR middle-end/17657 (ICE in expand_case)
PR middle-end/17657
* stmt.c (add_case_node): Add additional type argument. Declare
as static to match prototype. Convert the upper and lower bounds
to the specified index type. Optimize away case ranges/values
that are outside the index type's bounds. Truncate case ranges
that span the index type's bounds.
(expand_case): Avoid unnessary computation and memory allocation
when index type is error_mark_node. Pass index_type as required
by change to add_case_node API. No need to convert case range
bounds to index_type, this is now done by add_case_node.
* gcc.dg/switch-4.c: New test case.
From-SVN: r88881
Diffstat (limited to 'gcc/testsuite/gcc.dg/switch-4.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/switch-4.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/switch-4.c b/gcc/testsuite/gcc.dg/switch-4.c new file mode 100644 index 0000000..f2d8530 --- /dev/null +++ b/gcc/testsuite/gcc.dg/switch-4.c @@ -0,0 +1,24 @@ +/* PR middle-end/17657 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern signed char foo(int); + +void bar (void) +{ + signed char tmp = foo (0); + int t1 = tmp; + switch (t1) + { + case 1: foo (1); break; + case 2: foo (2); break; + case 3: foo (3); break; + case 4: foo (4); break; + case 5: foo (5); break; + case 6: foo (6); break; + case 7: foo (7); break; + case 255: foo (8); break; + default: break; + } +} + |