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
d90ec4f2
Commit
d90ec4f2
authored
Oct 28, 2015
by
Jason Merrill
Committed by
Jason Merrill
Oct 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* c-common.c (pointer_int_sum): Fold the MULT_EXPR.
From-SVN: r229500
parent
a6392fdc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
gcc/c-family/ChangeLog
+4
-0
gcc/c-family/c-common.c
+2
-3
gcc/testsuite/gcc.dg/pointer-arith-10.c
+6
-1
No files found.
gcc/c-family/ChangeLog
View file @
d90ec4f2
2015
-
10
-
28
Jason
Merrill
<
jason
@
redhat
.
com
>
*
c
-
common
.
c
(
pointer_int_sum
):
Fold
the
MULT_EXPR
.
2015
-
10
-
27
Thomas
Schwinge
<
thomas
@
codesourcery
.
com
>
James
Norris
<
jnorris
@
codesourcery
.
com
>
Cesar
Philippidis
<
cesar
@
codesourcery
.
com
>
...
...
gcc/c-family/c-common.c
View file @
d90ec4f2
...
...
@@ -4849,9 +4849,8 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
for the pointer operation and disregard an overflow that occurred only
because of the sign-extension change in the latter conversion. */
{
tree
t
=
build_binary_op
(
loc
,
MULT_EXPR
,
intop
,
convert
(
TREE_TYPE
(
intop
),
size_exp
),
1
);
tree
t
=
fold_build2_loc
(
loc
,
MULT_EXPR
,
TREE_TYPE
(
intop
),
intop
,
convert
(
TREE_TYPE
(
intop
),
size_exp
));
intop
=
convert
(
sizetype
,
t
);
if
(
TREE_OVERFLOW_P
(
intop
)
&&
!
TREE_OVERFLOW
(
t
))
intop
=
wide_int_to_tree
(
TREE_TYPE
(
intop
),
intop
);
...
...
gcc/testsuite/gcc.dg/pointer-arith-10.c
View file @
d90ec4f2
...
...
@@ -6,4 +6,9 @@ char *foo(char *p, __UINTPTR_TYPE__ i)
return
(
char
*
)
i
+
(
__UINTPTR_TYPE__
)
p
;
}
/* { dg-final { scan-tree-dump "p +" "original" } } */
/* Check that we use a POINTER_PLUS_EXPR, not something like
return (char *) ((sizetype) p + (sizetype) i); */
/* { dg-final { scan-tree-dump-not "sizetype.*sizetype" "original" } } */
/* And also that we don't swap the operands. */
/* { dg-final { scan-tree-dump-not "return p +" "original" } } */
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