* [PATCH] Fix c54a13b
@ 2004-10-12 22:31 Andrew Pinski
2004-10-13 6:03 ` Roger Sayle
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Pinski @ 2004-10-12 22:31 UTC (permalink / raw)
To: GCC Patches; +Cc: laurent
The problem here is that types can have non constant min and max
values which cause an ICE in stmt.c where we just use
tree_int_cst_compare instead of checking to make sure that we have
INTEGER_CST.
OK? Bootstrapped and tested on powerpc-darwin (Ada's support
library still not able to build fully here, I just tested
that the testcase now passes).
Thanks,
Andrew Pinski
ChangeLog:
* stmt.c (add_case_node): Make sure that we have integer
constant before calling tree_int_cst_compare.
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.398
diff -u -p -r1.398 stmt.c
--- stmt.c 11 Oct 2004 16:11:29 -0000 1.398
+++ stmt.c 12 Oct 2004 22:19:31 -0000
@@ -2139,8 +2139,10 @@ add_case_node (struct case_node *head, t
if (!high || tree_int_cst_equal (low, high))
{
/* If the simple case value is unreachable, ignore it. */
- if (tree_int_cst_compare (low, min_value) < 0
- || tree_int_cst_compare (low, max_value) > 0)
+ if ((TREE_CODE (min_value) == INTEGER_CST
+ && tree_int_cst_compare (low, min_value) < 0)
+ || (TREE_CODE (max_value) == INTEGER_CST
+ && tree_int_cst_compare (low, max_value) > 0))
return head;
low = fold_convert (type, low);
high = low;
@@ -2148,19 +2150,23 @@ add_case_node (struct case_node *head, t
else
{
/* If the entire case range is unreachable, ignore it. */
- if (tree_int_cst_compare (high, min_value) < 0
- || tree_int_cst_compare (low, max_value) > 0)
+ if ((TREE_CODE (min_value) == INTEGER_CST
+ && tree_int_cst_compare (high, min_value) < 0)
+ || (TREE_CODE (max_value) == INTEGER_CST
+ && tree_int_cst_compare (low, max_value) > 0))
return head;
/* If the lower bound is less than the index type's minimum
value, truncate the range bounds. */
- if (tree_int_cst_compare (low, min_value) < 0)
+ if (TREE_CODE (min_value) == INTEGER_CST
+ && tree_int_cst_compare (low, min_value) < 0)
low = min_value;
low = fold_convert (type, low);
/* If the upper bound is greater than the index type's maximum
value, truncate the range bounds. */
- if (tree_int_cst_compare (high, max_value) > 0)
+ if (TREE_CODE (max_value) == INTEGER_CST
+ && tree_int_cst_compare (high, max_value) > 0)
high = max_value;
high = fold_convert (type, high);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix c54a13b
2004-10-12 22:31 [PATCH] Fix c54a13b Andrew Pinski
@ 2004-10-13 6:03 ` Roger Sayle
2004-10-15 10:56 ` Laurent GUERBY
0 siblings, 1 reply; 6+ messages in thread
From: Roger Sayle @ 2004-10-13 6:03 UTC (permalink / raw)
To: Andrew Pinski; +Cc: laurent, gcc-patches
On Tue, 12 Oct 2004, Andrew Pinski wrote:
> * stmt.c (add_case_node): Make sure that we have integer
> constant before calling tree_int_cst_compare.
This is OK for mainline. Sorry for the inconvenience to the Ada
folks. This code was based upon c-common.c's check_case_bounds
which obviously doesn't have to worry about Ada's non-constant
type bounds.
Roger
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix c54a13b
2004-10-13 6:03 ` Roger Sayle
@ 2004-10-15 10:56 ` Laurent GUERBY
0 siblings, 0 replies; 6+ messages in thread
From: Laurent GUERBY @ 2004-10-15 10:56 UTC (permalink / raw)
To: Roger Sayle; +Cc: Andrew Pinski, gcc-patches
I confirm andrew patch fixes c54a13b on x86 and x86_64 linux.
Laurent
On Wed, 2004-10-13 at 05:15, Roger Sayle wrote:
> On Tue, 12 Oct 2004, Andrew Pinski wrote:
> > * stmt.c (add_case_node): Make sure that we have integer
> > constant before calling tree_int_cst_compare.
>
> This is OK for mainline. Sorry for the inconvenience to the Ada
> folks. This code was based upon c-common.c's check_case_bounds
> which obviously doesn't have to worry about Ada's non-constant
> type bounds.
>
> Roger
> --
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix c54a13b
@ 2004-10-12 23:17 Richard Kenner
2004-10-12 23:22 ` Andrew Pinski
0 siblings, 1 reply; 6+ messages in thread
From: Richard Kenner @ 2004-10-12 23:17 UTC (permalink / raw)
To: pinskia; +Cc: gcc-patches
The problem here is that types can have non constant min and max
values which cause an ICE in stmt.c where we just use
tree_int_cst_compare instead of checking to make sure that we have
INTEGER_CST.
Interesting. I don't see that test failing on my runs.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix c54a13b
2004-10-12 23:17 Richard Kenner
@ 2004-10-12 23:22 ` Andrew Pinski
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Pinski @ 2004-10-12 23:22 UTC (permalink / raw)
To: Richard Kenner; +Cc: gcc-patches
On Oct 12, 2004, at 7:14 PM, Richard Kenner wrote:
> The problem here is that types can have non constant min and max
> values which cause an ICE in stmt.c where we just use
> tree_int_cst_compare instead of checking to make sure that we have
> INTEGER_CST.
>
> Interesting. I don't see that test failing on my runs.
Laurent Guerby reported this to me on IRC and I decided to look into
as I was trying to figure out why the bootstrap is failing on
powerpc-darwin with Ada enabled.
Also the patch which caused this was committed yesterday:
2004-10-11 Roger Sayle <roger@eyesopen.com>
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.
Thanks,
Andrew Pinski
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix c54a13b
@ 2004-10-12 23:30 Richard Kenner
0 siblings, 0 replies; 6+ messages in thread
From: Richard Kenner @ 2004-10-12 23:30 UTC (permalink / raw)
To: pinskia; +Cc: gcc-patches
Also the patch which caused this was committed yesterday:
That explains it. My last ACATS run was 11 AM Sunday.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-10-15 10:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-12 22:31 [PATCH] Fix c54a13b Andrew Pinski
2004-10-13 6:03 ` Roger Sayle
2004-10-15 10:56 ` Laurent GUERBY
2004-10-12 23:17 Richard Kenner
2004-10-12 23:22 ` Andrew Pinski
2004-10-12 23:30 Richard Kenner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).