diff options
author | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-19 16:45:59 +0000 |
---|---|---|
committer | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-19 16:45:59 +0000 |
commit | 085bb6ea41b26489c7e95ef93a99181be3b346ce (patch) | |
tree | f725ea41922a90374491a58c72f4c03b4c46444c | |
parent | 6b5f73b1f8eff5512e898d086b47983c10eaa4b0 (diff) | |
download | gcc-085bb6ea41b26489c7e95ef93a99181be3b346ce.tar.gz |
PR middle-end/20493
* fold-const.c (fold_widened_comparison): Don't optimize casts of
function pointers on targets that require function pointer
canonicalization.
(fold_sign_changed_comparison): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96733 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fold-const.c | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c55ed73260e..f40720a5041 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR middle-end/20493 + * fold-const.c (fold_widened_comparison): Don't optimize casts of + function pointers on targets that require function pointer + canonicalization. + (fold_sign_changed_comparison): Likewise. + 2005-03-19 Bernd Schmidt <bernd.schmidt@analog.com> * combine.c (try_combine): When changing the mode of a hard reg, make diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 13e91530cb0..bc17c1d3e9c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6074,6 +6074,15 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1) return NULL_TREE; shorter_type = TREE_TYPE (arg0_unw); +#ifdef HAVE_canonicalize_funcptr_for_compare + /* Disable this optimization if we're casting a function pointer + type on targets that require function pointer canonicalization. */ + if (HAVE_canonicalize_funcptr_for_compare + && TREE_CODE (shorter_type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (shorter_type)) == FUNCTION_TYPE) + return NULL_TREE; +#endif + if (TYPE_PRECISION (TREE_TYPE (arg0)) <= TYPE_PRECISION (shorter_type)) return NULL_TREE; @@ -6156,6 +6165,15 @@ fold_sign_changed_comparison (enum tree_code code, tree type, arg0_inner = TREE_OPERAND (arg0, 0); inner_type = TREE_TYPE (arg0_inner); +#ifdef HAVE_canonicalize_funcptr_for_compare + /* Disable this optimization if we're casting a function pointer + type on targets that require function pointer canonicalization. */ + if (HAVE_canonicalize_funcptr_for_compare + && TREE_CODE (inner_type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE) + return NULL_TREE; +#endif + if (TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type)) return NULL_TREE; |