diff options
| author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-28 16:49:12 +0000 |
|---|---|---|
| committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-28 16:49:12 +0000 |
| commit | 136335a28f44c3eeab45ca715f30c6dcfe59e1b4 (patch) | |
| tree | 393da7d6a3e8965560f998f6bfda921dfff70f2b | |
| parent | 8c8a79f4327e1a826a73e3cf8934e0a6c85f2f42 (diff) | |
| download | ppe42-gcc-136335a28f44c3eeab45ca715f30c6dcfe59e1b4.tar.gz ppe42-gcc-136335a28f44c3eeab45ca715f30c6dcfe59e1b4.zip | |
* tree-chrec.c (chrec_convert_aggressive): Do not eliminate
conversions where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not cover
the range allowed by TYPE_PRECISION.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111568 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/tree-chrec.c | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3484670a0a6..7ba31346670 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2006-02-28 Jeff Law <law@redhat.com> + * tree-chrec.c (chrec_convert_aggressive): Do not eliminate + conversions where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not cover + the range allowed by TYPE_PRECISION. + * tree.h (strct phi_arg_d): Remove unused NONZERO field. 2006-02-28 Dorit Nuzman <dorit@il.ibm.com> diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index b1587a5f91d..8edc5b9bbec 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -1219,6 +1219,26 @@ chrec_convert_aggressive (tree type, tree chrec) if (!rc) rc = chrec_convert (type, right, NULL_TREE); + /* Ada creates sub-types where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not + cover the entire range of values allowed by TYPE_PRECISION. + + We do not want to optimize away conversions to such types. Long + term I'd rather see the Ada front-end fixed. */ + if (INTEGRAL_TYPE_P (type)) + { + tree t; + + t = upper_bound_in_type (type, inner_type); + if (! TYPE_MAX_VALUE (type) + || ! operand_equal_p (TYPE_MAX_VALUE (type), t, 0)) + return NULL_TREE; + + t = lower_bound_in_type (type, inner_type); + if (! TYPE_MIN_VALUE (type) + || ! operand_equal_p (TYPE_MIN_VALUE (type), t, 0)) + return NULL_TREE; + } + return build_polynomial_chrec (CHREC_VARIABLE (chrec), lc, rc); } |

