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
a763aa92
Commit
a763aa92
authored
Feb 01, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Don't crash on type switch case nil with selector.
From-SVN: r183782
parent
7d189538
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
gcc/go/gofrontend/gogo.cc
+18
-0
gcc/go/gofrontend/gogo.h
+1
-2
No files found.
gcc/go/gofrontend/gogo.cc
View file @
a763aa92
...
@@ -3848,6 +3848,24 @@ Variable::add_preinit_statement(Gogo* gogo, Statement* s)
...
@@ -3848,6 +3848,24 @@ Variable::add_preinit_statement(Gogo* gogo, Statement* s)
b
->
set_end_location
(
s
->
location
());
b
->
set_end_location
(
s
->
location
());
}
}
// Whether this variable has a type.
bool
Variable
::
has_type
()
const
{
if
(
this
->
type_
==
NULL
)
return
false
;
// A variable created in a type switch case nil does not actually
// have a type yet. It will be changed to use the initializer's
// type in determine_type.
if
(
this
->
is_type_switch_var_
&&
this
->
type_
->
is_nil_constant_as_type
())
return
false
;
return
true
;
}
// In an assignment which sets a variable to a tuple of EXPR, return
// In an assignment which sets a variable to a tuple of EXPR, return
// the type of the first element of the tuple.
// the type of the first element of the tuple.
...
...
gcc/go/gofrontend/gogo.h
View file @
a763aa92
...
@@ -1154,8 +1154,7 @@ class Variable
...
@@ -1154,8 +1154,7 @@ class Variable
// Return whether the type is defined yet.
// Return whether the type is defined yet.
bool
bool
has_type
()
const
has_type
()
const
;
{
return
this
->
type_
!=
NULL
;
}
// Get the initial value.
// Get the initial value.
Expression
*
Expression
*
...
...
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