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
fd9df055
Commit
fd9df055
authored
Jan 24, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Correct type of expressions involving character constants.
From-SVN: r183490
parent
2c49569e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
gcc/go/gofrontend/expressions.cc
+28
-0
No files found.
gcc/go/gofrontend/expressions.cc
View file @
fd9df055
...
...
@@ -5556,7 +5556,9 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*,
Expression
*
ret
=
NULL
;
if
(
left_type
!=
right_type
&&
left_type
!=
NULL
&&
!
left_type
->
is_abstract
()
&&
right_type
!=
NULL
&&
!
right_type
->
is_abstract
()
&&
left_type
->
base
()
!=
right_type
->
base
()
&&
op
!=
OPERATOR_LSHIFT
&&
op
!=
OPERATOR_RSHIFT
)
...
...
@@ -5608,6 +5610,26 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*,
type
=
right_type
;
else
type
=
left_type
;
bool
is_character
=
false
;
if
(
type
==
NULL
)
{
Type
*
t
=
this
->
left_
->
type
();
if
(
t
->
integer_type
()
!=
NULL
&&
t
->
integer_type
()
->
is_rune
())
is_character
=
true
;
else
if
(
op
!=
OPERATOR_LSHIFT
&&
op
!=
OPERATOR_RSHIFT
)
{
t
=
this
->
right_
->
type
();
if
(
t
->
integer_type
()
!=
NULL
&&
t
->
integer_type
()
->
is_rune
())
is_character
=
true
;
}
}
if
(
is_character
)
ret
=
Expression
::
make_character
(
&
val
,
type
,
location
);
else
ret
=
Expression
::
make_integer
(
&
val
,
type
,
location
);
}
...
...
@@ -6252,6 +6274,12 @@ Binary_expression::do_type()
return
left_type
;
else
if
(
right_type
->
float_type
()
!=
NULL
)
return
right_type
;
else
if
(
left_type
->
integer_type
()
!=
NULL
&&
left_type
->
integer_type
()
->
is_rune
())
return
left_type
;
else
if
(
right_type
->
integer_type
()
!=
NULL
&&
right_type
->
integer_type
()
->
is_rune
())
return
right_type
;
else
return
left_type
;
}
...
...
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