Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
6946afd3
Commit
6946afd3
authored
Mar 09, 1994
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(pointer_int_sum): Multiplication should be done signed.
(pointer_diff): Likewise the division. From-SVN: r6733
parent
7a3b13d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
gcc/c-typeck.c
+8
-4
No files found.
gcc/c-typeck.c
View file @
6946afd3
...
...
@@ -2520,10 +2520,13 @@ pointer_int_sum (resultcode, ptrop, intop)
if
(
TYPE_PRECISION
(
TREE_TYPE
(
intop
))
!=
POINTER_SIZE
)
intop
=
convert
(
type_for_size
(
POINTER_SIZE
,
0
),
intop
);
/* Replace the integer argument
with a suitable product by the object size. */
/* Replace the integer argument with a suitable product by the object size.
Do this multiplication as signed, then convert to the appropriate
pointer type (actually unsigned integral). */
intop
=
build_binary_op
(
MULT_EXPR
,
intop
,
size_exp
,
1
);
intop
=
convert
(
result_type
,
build_binary_op
(
MULT_EXPR
,
intop
,
convert
(
TREE_TYPE
(
intop
),
size_exp
),
1
));
/* Create the sum or difference. */
...
...
@@ -2563,12 +2566,13 @@ pointer_diff (op0, op1)
/* This generates an error if op1 is pointer to incomplete type. */
if
(
TYPE_SIZE
(
TREE_TYPE
(
TREE_TYPE
(
op1
)))
==
0
)
error
(
"arithmetic on pointer to an incomplete type"
);
/* This generates an error if op0 is pointer to incomplete type. */
op1
=
c_size_in_bytes
(
target_type
);
/* Divide by the size, in easiest possible way. */
result
=
build
(
EXACT_DIV_EXPR
,
restype
,
op0
,
op1
);
result
=
build
(
EXACT_DIV_EXPR
,
restype
,
op0
,
convert
(
restype
,
op1
)
);
folded
=
fold
(
result
);
if
(
folded
==
result
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment