[Bug go/89321] New: cross build with riscv64 gccgo compilation failed due to assert in constructor_expression

2019-02-12 Thread sean.wang at wdc dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89321

Bug ID: 89321
   Summary: cross build with riscv64 gccgo compilation failed due
to assert in constructor_expression
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: go
  Assignee: ian at airs dot com
  Reporter: sean.wang at wdc dot com
CC: cmang at google dot com
  Target Milestone: ---

* Built cross toolchain for riscv64 via gcc master branch commit hash
<4426330625ecc522a5214a990d88a68dc197b15f>

* glibc from 2.28 release branch

* Go build command: 
 /usr/local/go/bin/go/bin/go [build -o /artifacts/xx/ -compiler gccgo -v
-work -x -gccgoflags -w -s -g3 -X main.gitHash=xxx -g3 -X main.g
tUnixTime=0 -extldflags "-static -Wl,--no-export-dynamic" ./xxx]
WORK=/tmp/go-build855483278

* gccgo command:
 /scratch/cross-gccgo/tools/bin/gccgo -c -g
-fgo-pkgpath=/xxx/xxx/internal/xxx-o $WORK/b296/_go_.o -I
$WORK/b296/_importcfgroot_ ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go
./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go
./xxx.go ./xxx.go ./xxx.go ./xxx.g\
o ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go ./xxx.go
./xxx.go

* gccgo compilation warning:
 /deps/riscv64/include/libavutil/mem.h:186:1: warning: 'allg: 'alloc_size'
attribute ignored on a function returning[-Wattributes]
   186 | av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb,
size_t size);
   | ^

* gccgo internal compiler error:
--BEGIN--
# /xx/xxx/internal/xxx
go1: internal compiler error: in constructor_expression, at
go/go-gcc.cc:1811
0x638fb5 Gcc_backend::constructor_expression(Btype*,
std::vector > const&, Location)
/scratch/cross-gccgo/src/gcc/gcc/go/go-gcc.cc:1811
0x6265de
Struct_construction_expression::do_get_backend(Translate_context*)
   
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/expressions.cc:13091
0x628393
Array_construction_expression::get_constructor(Translate_context*, Btype*)
   
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/expressions.cc:13315
0x68dff2 Temporary_statement::do_get_backend(Translate_context*)
   
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/statements.cc:548
0x64f7ad Block::get_backend(Translate_context*)
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/gogo.cc:
0x689fac Block_statement::do_get_backend(Translate_context*)
   
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/statements.cc:1860
0x64f7ad Block::get_backend(Translate_context*)
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/gogo.cc:
0x652b4e Function::build(Gogo*, Named_object*)
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/gogo.cc:6141
0x65377b Named_object::get_backend(Gogo*, std::vector >&, std::vector >&,
std::vector >&)
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/gogo.cc:8228
0x65beb1 Gogo::write_globals()
/scratch/cross-gccgo/src/gcc/gcc/go/gofrontend/gogo.cc:1443
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
--END --

[Bug go/89321] cross build with riscv64 gccgo compilation failed due to assert in constructor_expression

2019-02-12 Thread sean.wang at wdc dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89321

--- Comment #2 from sean.wang at wdc dot com ---
I can certainly try. Based on the backtrace, do you have an educated guess on
what type of condition in the code that I can try to isolate? For example, what
does the assert condition mean? Thank you.

[Bug go/89321] cross build with riscv64 gccgo compilation failed due to assert in constructor_expression

2019-02-13 Thread sean.wang at wdc dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89321

--- Comment #4 from sean.wang at wdc dot com ---
The assert it reached was this I think:
 gcc_assert(field == NULL_TREE);

Thanks, Ian. It is helpful. I think I found a way to reproduce this issue on a
smaller set of code. Will provide an example once I have everything stubbed
out.

[Bug go/89321] cross build with riscv64 gccgo compilation failed due to assert in constructor_expression

2019-02-13 Thread sean.wang at wdc dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89321

--- Comment #5 from sean.wang at wdc dot com ---
Created attachment 45709
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45709&action=edit
code sample for reproducing reported error

code sample for reproducing reported error is attached.