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
605a99f6
Commit
605a99f6
authored
Apr 06, 1995
by
Jason Merrill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(build_binary_op): Don't call common_type for uncommon pointer types.
From-SVN: r9317
parent
b3ca463c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
17 deletions
+31
-17
gcc/c-typeck.c
+31
-17
No files found.
gcc/c-typeck.c
View file @
605a99f6
...
...
@@ -2187,7 +2187,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
Otherwise, the targets must be compatible
and both must be object or both incomplete. */
if
(
comp_target_types
(
type0
,
type1
))
;
result_type
=
common_type
(
type0
,
type1
)
;
else
if
(
TYPE_MAIN_VARIANT
(
tt0
)
==
void_type_node
)
{
/* op0 != orig_op0 detects the case of something
...
...
@@ -2204,7 +2204,9 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
}
else
pedwarn
(
"comparison of distinct pointer types lacks a cast"
);
result_type
=
common_type
(
type0
,
type1
);
if
(
result_type
==
NULL_TREE
)
result_type
=
ptr_type_node
;
}
else
if
(
code0
==
POINTER_TYPE
&&
TREE_CODE
(
op1
)
==
INTEGER_CST
&&
integer_zerop
(
op1
))
...
...
@@ -2233,12 +2235,18 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
shorten
=
1
;
else
if
(
code0
==
POINTER_TYPE
&&
code1
==
POINTER_TYPE
)
{
if
(
!
comp_target_types
(
type0
,
type1
))
pedwarn
(
"comparison of distinct pointer types lacks a cast"
);
else
if
(
pedantic
&&
TREE_CODE
(
TREE_TYPE
(
type0
))
==
FUNCTION_TYPE
)
pedwarn
(
"ANSI C forbids ordered comparisons of pointers to functions"
);
result_type
=
common_type
(
type0
,
type1
);
if
(
comp_target_types
(
type0
,
type1
))
{
result_type
=
common_type
(
type0
,
type1
);
if
(
pedantic
&&
TREE_CODE
(
TREE_TYPE
(
type0
))
==
FUNCTION_TYPE
)
pedwarn
(
"ANSI C forbids ordered comparisons of pointers to functions"
);
}
else
{
result_type
=
ptr_type_node
;
pedwarn
(
"comparison of distinct pointer types lacks a cast"
);
}
}
break
;
...
...
@@ -2252,15 +2260,21 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
short_compare
=
1
;
else
if
(
code0
==
POINTER_TYPE
&&
code1
==
POINTER_TYPE
)
{
if
(
!
comp_target_types
(
type0
,
type1
))
pedwarn
(
"comparison of distinct pointer types lacks a cast"
);
else
if
((
TYPE_SIZE
(
TREE_TYPE
(
type0
))
!=
0
)
!=
(
TYPE_SIZE
(
TREE_TYPE
(
type1
))
!=
0
))
pedwarn
(
"comparison of complete and incomplete pointers"
);
else
if
(
pedantic
&&
TREE_CODE
(
TREE_TYPE
(
type0
))
==
FUNCTION_TYPE
)
pedwarn
(
"ANSI C forbids ordered comparisons of pointers to functions"
);
result_type
=
common_type
(
type0
,
type1
);
if
(
comp_target_types
(
type0
,
type1
))
{
result_type
=
common_type
(
type0
,
type1
);
if
((
TYPE_SIZE
(
TREE_TYPE
(
type0
))
!=
0
)
!=
(
TYPE_SIZE
(
TREE_TYPE
(
type1
))
!=
0
))
pedwarn
(
"comparison of complete and incomplete pointers"
);
else
if
(
pedantic
&&
TREE_CODE
(
TREE_TYPE
(
type0
))
==
FUNCTION_TYPE
)
pedwarn
(
"ANSI C forbids ordered comparisons of pointers to functions"
);
}
else
{
result_type
=
ptr_type_node
;
pedwarn
(
"comparison of distinct pointer types lacks a cast"
);
}
}
else
if
(
code0
==
POINTER_TYPE
&&
TREE_CODE
(
op1
)
==
INTEGER_CST
&&
integer_zerop
(
op1
))
...
...
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