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
69d8df44
Commit
69d8df44
authored
Jun 25, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Fix type determination issues.
From-SVN: r200398
parent
7292300c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
gcc/go/gofrontend/expressions.cc
+18
-2
gcc/go/gofrontend/statements.cc
+4
-1
No files found.
gcc/go/gofrontend/expressions.cc
View file @
69d8df44
...
...
@@ -5668,6 +5668,7 @@ Binary_expression::do_determine_type(const Type_context* context)
if
(
tleft
->
is_abstract
()
&&
subcontext
.
type
!=
NULL
&&
!
subcontext
.
may_be_abstract
&&
subcontext
.
type
->
interface_type
()
==
NULL
&&
subcontext
.
type
->
integer_type
()
==
NULL
)
this
->
report_error
((
"invalid context-determined non-integer type "
"for left operand of shift"
));
...
...
@@ -7383,6 +7384,8 @@ Builtin_call_expression::lower_make()
Type
*
uintptr_type
=
Type
::
lookup_integer_type
(
"uintptr"
);
int
uintptr_bits
=
uintptr_type
->
integer_type
()
->
bits
();
Type_context
int_context
(
Type
::
lookup_integer_type
(
"int"
),
false
);
++
parg
;
Expression
*
len_arg
;
if
(
parg
==
args
->
end
())
...
...
@@ -7401,6 +7404,7 @@ Builtin_call_expression::lower_make()
else
{
len_arg
=
*
parg
;
len_arg
->
determine_type
(
&
int_context
);
if
(
!
this
->
check_int_value
(
len_arg
,
true
))
return
Expression
::
make_error
(
this
->
location
());
if
(
len_arg
->
type
()
->
integer_type
()
!=
NULL
...
...
@@ -7413,6 +7417,7 @@ Builtin_call_expression::lower_make()
if
(
is_slice
&&
parg
!=
args
->
end
())
{
cap_arg
=
*
parg
;
cap_arg
->
determine_type
(
&
int_context
);
if
(
!
this
->
check_int_value
(
cap_arg
,
false
))
return
Expression
::
make_error
(
this
->
location
());
...
...
@@ -8030,6 +8035,8 @@ Builtin_call_expression::do_determine_type(const Type_context* context)
case
BUILTIN_REAL
:
case
BUILTIN_IMAG
:
arg_type
=
Builtin_call_expression
::
complex_type
(
context
->
type
);
if
(
arg_type
==
NULL
)
arg_type
=
Type
::
lookup_complex_type
(
"complex128"
);
is_print
=
false
;
break
;
...
...
@@ -8038,6 +8045,8 @@ Builtin_call_expression::do_determine_type(const Type_context* context)
// For the complex function the type of one operand can
// determine the type of the other, as in a binary expression.
arg_type
=
Builtin_call_expression
::
real_imag_type
(
context
->
type
);
if
(
arg_type
==
NULL
)
arg_type
=
Type
::
lookup_float_type
(
"float64"
);
if
(
args
!=
NULL
&&
args
->
size
()
==
2
)
{
Type
*
t1
=
args
->
front
()
->
type
();
...
...
@@ -10379,13 +10388,20 @@ Array_index_expression::do_determine_type(const Type_context*)
void
Array_index_expression
::
do_check_types
(
Gogo
*
)
{
if
(
this
->
start_
->
type
()
->
integer_type
()
==
NULL
)
Numeric_constant
nc
;
unsigned
long
v
;
if
(
this
->
start_
->
type
()
->
integer_type
()
==
NULL
&&
!
this
->
start_
->
type
()
->
is_error
()
&&
(
!
this
->
start_
->
numeric_constant_value
(
&
nc
)
||
nc
.
to_unsigned_long
(
&
v
)
==
Numeric_constant
::
NC_UL_NOTINT
))
this
->
report_error
(
_
(
"index must be integer"
));
if
(
this
->
end_
!=
NULL
&&
this
->
end_
->
type
()
->
integer_type
()
==
NULL
&&
!
this
->
end_
->
type
()
->
is_error
()
&&
!
this
->
end_
->
is_nil_expression
()
&&
!
this
->
end_
->
is_error_expression
())
&&
!
this
->
end_
->
is_error_expression
()
&&
(
!
this
->
end_
->
numeric_constant_value
(
&
nc
)
||
nc
.
to_unsigned_long
(
&
v
)
==
Numeric_constant
::
NC_UL_NOTINT
))
this
->
report_error
(
_
(
"slice end must be integer"
));
Array_type
*
array_type
=
this
->
array_
->
type
()
->
array_type
();
...
...
gcc/go/gofrontend/statements.cc
View file @
69d8df44
...
...
@@ -569,7 +569,10 @@ void
Assignment_statement
::
do_determine_types
()
{
this
->
lhs_
->
determine_type_no_context
();
Type_context
context
(
this
->
lhs_
->
type
(),
false
);
Type
*
rhs_context_type
=
this
->
lhs_
->
type
();
if
(
rhs_context_type
->
is_sink_type
())
rhs_context_type
=
NULL
;
Type_context
context
(
rhs_context_type
,
false
);
this
->
rhs_
->
determine_type
(
&
context
);
}
...
...
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