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
173fb2ff
Commit
173fb2ff
authored
Dec 14, 2010
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't try to build unary and binary expressions with invalid types.
From-SVN: r167824
parent
5262c72a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
22 deletions
+20
-22
gcc/go/gofrontend/expressions.cc
+20
-22
No files found.
gcc/go/gofrontend/expressions.cc
View file @
173fb2ff
...
@@ -3824,29 +3824,28 @@ Unary_expression::do_determine_type(const Type_context* context)
...
@@ -3824,29 +3824,28 @@ Unary_expression::do_determine_type(const Type_context* context)
void
void
Unary_expression
::
do_check_types
(
Gogo
*
)
Unary_expression
::
do_check_types
(
Gogo
*
)
{
{
Type
*
type
=
this
->
expr_
->
type
();
if
(
type
->
is_error_type
())
{
this
->
set_is_error
();
return
;
}
switch
(
this
->
op_
)
switch
(
this
->
op_
)
{
{
case
OPERATOR_PLUS
:
case
OPERATOR_PLUS
:
case
OPERATOR_MINUS
:
case
OPERATOR_MINUS
:
{
if
(
type
->
integer_type
()
==
NULL
Type
*
type
=
this
->
expr_
->
type
();
&&
type
->
float_type
()
==
NULL
if
(
type
->
integer_type
()
==
NULL
&&
type
->
complex_type
()
==
NULL
)
&&
type
->
float_type
()
==
NULL
this
->
report_error
(
_
(
"expected numeric type"
));
&&
type
->
complex_type
()
==
NULL
&&
!
type
->
is_error_type
())
this
->
report_error
(
_
(
"expected numeric type"
));
}
break
;
break
;
case
OPERATOR_NOT
:
case
OPERATOR_NOT
:
case
OPERATOR_XOR
:
case
OPERATOR_XOR
:
{
if
(
type
->
integer_type
()
==
NULL
Type
*
type
=
this
->
expr_
->
type
();
&&
!
type
->
is_boolean_type
())
if
(
type
->
integer_type
()
==
NULL
this
->
report_error
(
_
(
"expected integer or boolean type"
));
&&
!
type
->
is_boolean_type
()
&&
!
type
->
is_error_type
())
this
->
report_error
(
_
(
"expected integer or boolean type"
));
}
break
;
break
;
case
OPERATOR_AND
:
case
OPERATOR_AND
:
...
@@ -3858,12 +3857,8 @@ Unary_expression::do_check_types(Gogo*)
...
@@ -3858,12 +3857,8 @@ Unary_expression::do_check_types(Gogo*)
case
OPERATOR_MULT
:
case
OPERATOR_MULT
:
// Indirecting through a pointer.
// Indirecting through a pointer.
{
if
(
type
->
points_to
()
==
NULL
)
Type
*
type
=
this
->
expr_
->
type
();
this
->
report_error
(
_
(
"expected pointer"
));
if
(
type
->
points_to
()
==
NULL
&&
!
type
->
is_error_type
())
this
->
report_error
(
_
(
"expected pointer"
));
}
break
;
break
;
default
:
default
:
...
@@ -5474,7 +5469,10 @@ Binary_expression::do_check_types(Gogo*)
...
@@ -5474,7 +5469,10 @@ Binary_expression::do_check_types(Gogo*)
Type
*
left_type
=
this
->
left_
->
type
();
Type
*
left_type
=
this
->
left_
->
type
();
Type
*
right_type
=
this
->
right_
->
type
();
Type
*
right_type
=
this
->
right_
->
type
();
if
(
left_type
->
is_error_type
()
||
right_type
->
is_error_type
())
if
(
left_type
->
is_error_type
()
||
right_type
->
is_error_type
())
return
;
{
this
->
set_is_error
();
return
;
}
if
(
this
->
op_
==
OPERATOR_EQEQ
if
(
this
->
op_
==
OPERATOR_EQEQ
||
this
->
op_
==
OPERATOR_NOTEQ
||
this
->
op_
==
OPERATOR_NOTEQ
...
...
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