public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug go/61265] New: gccgo: ICE in verify_gimple_in_seq [GoSmith]
@ 2014-05-21 9:21 dvyukov at google dot com
2014-12-17 17:43 ` [Bug go/61265] " cmang at google dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dvyukov at google dot com @ 2014-05-21 9:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61265
Bug ID: 61265
Summary: gccgo: ICE in verify_gimple_in_seq [GoSmith]
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: go
Assignee: ian at airs dot com
Reporter: dvyukov at google dot com
Created attachment 32840
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32840&action=edit
reproducer
gcc version 4.10.0 20140516 (experimental) (GCC)
The reproducer is attached (you need to set GOPATH to the root dir).
$ go build -compiler=gccgo main
# b
src/b/0.go: In function 'b.b..import':
src/b/0.go:1:1: error: non-trivial conversion at assignment
package b
^
int16 *[1][0:18446744073709551615][0:18446744073709551615]
int16 *[1][1][1]
D.1019[0] = b.Var868;
src/b/0.go:1:1: internal compiler error: verify_gimple failed
0xa29b2f verify_gimple_in_seq(gimple_statement_base*)
../../gcc/tree-cfg.c:4622
0x83aae4 gimplify_body(tree_node*, bool)
../../gcc/gimplify.c:8720
0x83aee6 gimplify_function_tree(tree_node*)
../../gcc/gimplify.c:8805
0x5c552e Gcc_backend::write_global_definitions(std::vector<Btype*,
std::allocator<Btype*> > const&, std::vector<Bexpression*,
std::allocator<Bexpression*> > const&, std::vector<Bfunction*,
std::allocator<Bfunction*> > const&, std::vector<Bvariable*,
std::allocator<Bvariable*> > const&)
../../gcc/go/go-gcc.cc:2889
0x5e3592 Gogo::write_globals()
../../gcc/go/gofrontend/gogo.cc:1292
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug go/61265] gccgo: ICE in verify_gimple_in_seq [GoSmith]
2014-05-21 9:21 [Bug go/61265] New: gccgo: ICE in verify_gimple_in_seq [GoSmith] dvyukov at google dot com
@ 2014-12-17 17:43 ` cmang at google dot com
2014-12-17 22:20 ` cmang at google dot com
2015-01-06 14:09 ` cmang at google dot com
2 siblings, 0 replies; 4+ messages in thread
From: cmang at google dot com @ 2014-12-17 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61265
--- Comment #2 from Chris Manghane <cmang at google dot com> ---
A slightly smaller program can reproduce this as well:
package main
var a = [1][0]int{B}[0]
var B = [0]int{}
func main() {}
This error occurs because in Gcc_backend::fill_in_array, the type of B, [0]int,
is represented using build_array_type(int, build_index_type(len - 1)), where
len is 0 in this case, giving it a range of [0:MAX_INT] where it should be
[0:0]. The following patch fixes this behavior:
Index: gcc/go/go-gcc.cc
======================================================================
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -887,9 +887,13 @@ Gcc_backend::fill_in_array(Btype* fill, Btype*
element_type,
// build_index_type takes the maximum index, which is one less than
// the length.
- tree index_type_tree = build_index_type(fold_build2(MINUS_EXPR, sizetype,
- length_tree,
- size_one_node));
+ tree index_type_tree = NULL_TREE;
+ if (length_tree == size_zero_node)
+ index_type_tree = build_index_type(size_zero_node);
+ else
+ index_type_tree = build_index_type(fold_build2(MINUS_EXPR, sizetype,
+ length_tree,
+ size_one_node));
tree fill_tree = fill->get_tree();
TREE_TYPE(fill_tree) = element_type_tree;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug go/61265] gccgo: ICE in verify_gimple_in_seq [GoSmith]
2014-05-21 9:21 [Bug go/61265] New: gccgo: ICE in verify_gimple_in_seq [GoSmith] dvyukov at google dot com
2014-12-17 17:43 ` [Bug go/61265] " cmang at google dot com
@ 2014-12-17 22:20 ` cmang at google dot com
2015-01-06 14:09 ` cmang at google dot com
2 siblings, 0 replies; 4+ messages in thread
From: cmang at google dot com @ 2014-12-17 22:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61265
--- Comment #3 from Chris Manghane <cmang at google dot com> ---
Sorry for the noise, responding with new information as I discover it.
The above patch doesn't really work (it fails a few tests) because this isn't a
problem with zero-sized array types, but rather a problem with zero-sized
elements in array types.
This same bug can be reproduced by
package main
var a = [1]struct{}{B}[0]
var B = struct{}{}
func main(){}
because struct{} is a zero-sized type and the backend implementation makes
assumptions about zero-sized globals for the linker. A better approach is to
just avoid constructing an array of zero-sized values and evaluate the
zero-valued expressions for their side effects. This is be done in
https://codereview.appspot.com/191970043/.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug go/61265] gccgo: ICE in verify_gimple_in_seq [GoSmith]
2014-05-21 9:21 [Bug go/61265] New: gccgo: ICE in verify_gimple_in_seq [GoSmith] dvyukov at google dot com
2014-12-17 17:43 ` [Bug go/61265] " cmang at google dot com
2014-12-17 22:20 ` cmang at google dot com
@ 2015-01-06 14:09 ` cmang at google dot com
2 siblings, 0 replies; 4+ messages in thread
From: cmang at google dot com @ 2015-01-06 14:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61265
Chris Manghane <cmang at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Chris Manghane <cmang at google dot com> ---
Fixed and test added to Go testsuite.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-06 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-21 9:21 [Bug go/61265] New: gccgo: ICE in verify_gimple_in_seq [GoSmith] dvyukov at google dot com
2014-12-17 17:43 ` [Bug go/61265] " cmang at google dot com
2014-12-17 22:20 ` cmang at google dot com
2015-01-06 14:09 ` cmang at google dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).