diff options
| author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-19 01:35:25 +0000 |
|---|---|---|
| committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-19 01:35:25 +0000 |
| commit | b2f8852969aa67df9ac70ce6dfd6f9ce2d3a301e (patch) | |
| tree | 8370a872c958fe7ffe9dea21b5735a742db71a92 | |
| parent | ef45a2696c58923d63a7854ea5bc0840ede96047 (diff) | |
| download | ppe42-gcc-b2f8852969aa67df9ac70ce6dfd6f9ce2d3a301e.tar.gz ppe42-gcc-b2f8852969aa67df9ac70ce6dfd6f9ce2d3a301e.zip | |
* fold-const.c (div_if_zero_remainder): Do signed divide for pointer
types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123966 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/fold-const.c | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1138a1a3d14..2e2fad3fbe6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-04-18 Jan Hubicka <jh@suse.cz> + + * fold-const.c (div_if_zero_remainder): Do signed divide for pointer + types. + 2007-04-18 Eric Christopher <echristo@apple.com> * config/rs6000/darwin.md (load_macho_picbase): Use link register diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 857065f1344..b0a2bb7d91e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -890,6 +890,17 @@ div_if_zero_remainder (enum tree_code code, tree arg1, tree arg2) int1l = TREE_INT_CST_LOW (arg1); int1h = TREE_INT_CST_HIGH (arg1); + /* &obj[0] + -128 really should be compiled as &obj[-8] rahter than + &obj[some_exotic_number]. */ + if (POINTER_TYPE_P (type)) + { + uns = false; + type = signed_type_for (type); + fit_double_type (int1l, int1h, &int1l, &int1h, + type); + } + else + fit_double_type (int1l, int1h, &int1l, &int1h, type); int2l = TREE_INT_CST_LOW (arg2); int2h = TREE_INT_CST_HIGH (arg2); |

