Skip to content

Commit

Permalink
compiler: Don't crash on erroneous array return types.
Browse files Browse the repository at this point in the history
    
    Another issue with erroneous array types.  When an erroneous array
    type is in a function's signature, particularly the return type, we
    must guarantee that type is changed into an error type.  Otherwise,
    any operations that work on arrays and slices will crash when applied
    to the erroneous array return type.
    
    Fixes golang/go#12939.
    
    Reviewed-on: https://go-review.googlesource.com/16235


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232858 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
ian committed Jan 27, 2016
1 parent 09a4541 commit 4d4acdc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcc/go/gofrontend/MERGE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
721c778adb8f99d8a6b7795dbad86013ccc9ba91
9e68d67d65fd72b9b4f163f2f26e15cd0d3e2cd2

The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
2 changes: 2 additions & 0 deletions gcc/go/gofrontend/parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ Parse::array_type(bool may_use_ellipsis)
}

Type* element_type = this->type();
if (element_type->is_error_type())
return Type::make_error_type();

return Type::make_array_type(element_type, length);
}
Expand Down

0 comments on commit 4d4acdc

Please sign in to comment.