Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: segfault #10285

Closed
h4ck3rm1k3 opened this issue Mar 30, 2015 · 1 comment
Closed

gccgo: segfault #10285

h4ck3rm1k3 opened this issue Mar 30, 2015 · 1 comment

Comments

@h4ck3rm1k3
Copy link

This does not crash on my debian amd64, but on the ppc64le arch with the latest gcc.
The code is from the core go lib. src/runtime/print1.go
Part of the #10092 task.

@ianlancetaylor here is the reduced bug report.

package main
func gwrite(b []byte) {
        n := copy(gp.writebuf[len(gp.writebuf):cap(gp.writebuf)], b)
}

produces the stacktrace
gccgo (GCC) 5.0.0 20150328 (experimental)(103cf1a425ceb970ef376580800ec19845a378f0)
Linux gcc2-power8.osuosl.org 3.17.4-301.fc21.ppc64le #1 SMP Mon Dec 1 07:51:01 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux

 ~/install/bin/gccgo testcase.go 
testcase.go:5:12: error: reference to undefined name ‘gp’
  n := copy(gp.writebuf[len(gp.writebuf):cap(gp.writebuf)], b)
            ^
testcase.go:5:28: error: reference to undefined name ‘gp’
  n := copy(gp.writebuf[len(gp.writebuf):cap(gp.writebuf)], b)
                            ^
testcase.go:5:45: error: reference to undefined name ‘gp’
  n := copy(gp.writebuf[len(gp.writebuf):cap(gp.writebuf)], b)
                                             ^
testcase.go:5:2: error: ‘n’ declared and not used
  n := copy(gp.writebuf[len(gp.writebuf):cap(gp.writebuf)], b)
  ^
go1: internal compiler error: Segmentation fault
0x107f0433 crash_signal
        ../../gcc/toplev.c:383
0x1026bf80 Array_type::get_value_pointer(Gogo*, Expression*) const
        ../../gcc/go/gofrontend/types.cc:6163
0x101d4ddf Builtin_call_expression::do_get_backend(Translate_context*)
        ../../gcc/go/gofrontend/expressions.cc:8353
0x101c2c47 Expression::get_backend(Translate_context*)
        ../../gcc/go/gofrontend/expressions.cc:411
0x101d846b Type_conversion_expression::do_get_backend(Translate_context*)
        ../../gcc/go/gofrontend/expressions.cc:3340
0x101c2c47 Expression::get_backend(Translate_context*)
        ../../gcc/go/gofrontend/expressions.cc:411
0x1020aebb Variable::get_init(Gogo*, Named_object*)
        ../../gcc/go/gofrontend/gogo.cc:6195
0x1025ec8f Variable_declaration_statement::do_get_backend(Translate_context*)
        ../../gcc/go/gofrontend/statements.cc:267
0x10253797 Statement::get_backend(Translate_context*)
        ../../gcc/go/gofrontend/statements.cc:141
0x10216e4f Block::get_backend(Translate_context*)
        ../../gcc/go/gofrontend/gogo.cc:5648
0x10217bd7 Function::build(Gogo*, Named_object*)
        ../../gcc/go/gofrontend/gogo.cc:5254
0x10218503 Named_object::get_backend(Gogo*, std::vector<Bexpression*, std::allocator<Bexpression*> >&, std::vector<Btype*, std::allocator<Btype*> >&, std::vector\
<Bfunction*, std::allocator<Bfunction*> >&)
        ../../gcc/go/gofrontend/gogo.cc:6973
0x1022058f Gogo::write_globals()
        ../../gcc/go/gofrontend/gogo.cc:1289
0x102045bf go_write_globals()
        ../../gcc/go/gofrontend/go.cc:147
0x101fe727 go_langhook_write_globals
        ../../gcc/go/go-lang.c:463
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

@mikioh mikioh changed the title gccgo segfault gccgo: segfault Mar 30, 2015
@ianlancetaylor ianlancetaylor self-assigned this Mar 30, 2015
@ianlancetaylor
Copy link
Contributor

Fixed on tip.

Note that this is a crash on invalid code, and that is what I fixed. I don't know if there is another compiler crash on valid code somewhere.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants