diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-11-18 00:10:23 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-11-20 00:08:40 +0100 |
| commit | d4681529c20d5cb2630bfe09f4cf4c4ca4c98a23 (patch) | |
| tree | d11bc100c2e35fe7ee8e84837d8e2826e4b8731e /gcc | |
| parent | 9b4b13e0d9030bb21c86eea6c4ba00bf4d91f0a0 (diff) | |
| download | elna-d4681529c20d5cb2630bfe09f4cf4c4ca4c98a23.tar.gz | |
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/gcc/elna-tree.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/gcc/elna-tree.cc b/gcc/gcc/elna-tree.cc index 9612ae2..afc809b 100644 --- a/gcc/gcc/elna-tree.cc +++ b/gcc/gcc/elna-tree.cc @@ -138,11 +138,14 @@ namespace elna::gcc convert_expression = fold_build1(NEGATE_EXPR, size_type_node, convert_expression); return fold_build2_loc(operation_location, POINTER_PLUS_EXPR, pointer_type, left, convert_expression); } - else if (POINTER_TYPE_P(left_type) && POINTER_TYPE_P(right_type) && left_type == right_type) + else if (POINTER_TYPE_P(left_type) && POINTER_TYPE_P(right_type)) { - return fold_build2_loc(operation_location, POINTER_DIFF_EXPR, ptrdiff_type_node, left, right); + tree size_exp = pointer_stride(left_type, ptrdiff_type_node); + tree diff = fold_build2_loc(operation_location, POINTER_DIFF_EXPR, ptrdiff_type_node, left, right); + + return fold_build2_loc(operation_location, EXACT_DIV_EXPR, ptrdiff_type_node, diff, size_exp); } - return error_mark_node; + gcc_unreachable(); } gcc_unreachable(); } |
