[Bug target/87438] ICE building gfortran for MicroBlaze target

2019-08-10 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87438

--- Comment #2 from Zach van Rijn  ---
Using GCC 8-20180706 snapshot,

gcc -c -O2 -fPIC grapes.c 
during RTL pass: reload
grapes.c: In function 'smaxval_r8':
grapes.c:57:1: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1155
 }
 ^
0x408422 gen_reg_rtx(machine_mode)
../../src_gcc/gcc/emit-rtl.c:1155
0x5e6ba6 force_reg(machine_mode, rtx_def*)
../../src_gcc/gcc/explow.c:665
0xc25604 gen_movdf(rtx_def*, rtx_def*)
../../src_gcc/gcc/config/microblaze/microblaze.md:1224
0x5fe6c5 insn_gen_fn::operator()(rtx_def*, rtx_def*) const
../../src_gcc/gcc/recog.h:301
0x5fe6c5 emit_move_insn_1(rtx_def*, rtx_def*)
../../src_gcc/gcc/expr.c:3666
0x603b45 gen_move_insn(rtx_def*, rtx_def*)
../../src_gcc/gcc/expr.c:3782
0x80e858 gen_reload
../../src_gcc/gcc/reload1.c:8740
0x8171a7 emit_input_reload_insns
../../src_gcc/gcc/reload1.c:7632
0x8171a7 do_input_reload
../../src_gcc/gcc/reload1.c:7919
0x8171a7 emit_reload_insns
../../src_gcc/gcc/reload1.c:8107
0x8171a7 reload_as_needed
../../src_gcc/gcc/reload1.c:4647
0x81ab76 reload(rtx_insn*, int)
../../src_gcc/gcc/reload1.c:1050
0x7044ea do_reload
../../src_gcc/gcc/ira.c:5477
0x7044ea execute
../../src_gcc/gcc/ira.c:5649

[Bug target/87438] ICE building gfortran for MicroBlaze target

2019-08-10 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87438

--- Comment #1 from Zach van Rijn  ---
Created attachment 46699
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46699&action=edit
Test case. Triggers bug on 8.x to at least 10-20190721.

[Bug target/89012] SH2 (FDPIC) duplicate symbols in generated assembly.

2019-01-28 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89012

--- Comment #5 from Zach van Rijn  ---
Created attachment 45546
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45546&action=edit
All files produced by -O2 -da

[Bug target/89012] SH2 (FDPIC) duplicate symbols in generated assembly.

2019-01-28 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89012

--- Comment #4 from Zach van Rijn  ---
The error can be reproduced at `O1` optimization level with both
(strictly both) of the following options:

./cc -c mintest.c -O1 -freorder-blocks-algorithm=stc -ftree-pre

Changing to `-freorder-blocks-algorithm=simple` will not reveal
the issue at `O1`, `O2` or `O3`.

In summary, the only known ways to reproduce this issue are:

(0) `-O2` as described in original bug report;

(1) `-O1 -freorder-blocks-algorithm=stc -ftree-pre`, exclusively
not at any other optimization level;

and the only known ways ot mitigate this issue using either of
the above configurations are:

(2) `-O2 -freorder-blocks-algorithm=simple`;

(3) `-O1` without specifically both of the aforementioned flags.

The attached tarball contains 5 files named by letters 'A' - 'E'
containing the generated assembly, each with -dp` as suggested:

(A) FAIL: `-O2 -freorder-blocks-algorithm=stc`

(B) PASS: `-O2 -freorder-blocks-algorithm=simple`

(C) FAIL: `-O1 -freorder-blocks-algorithm=stc -ftree-pre`

(D) PASS: `-O1 -freorder-blocks-algorithm=simple -ftree-pre`

(E) PASS: `-O1 -freorder-blocks-algorithm=stc`

[Bug target/89012] SH2 (FDPIC) duplicate symbols in generated assembly.

2019-01-28 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89012

--- Comment #3 from Zach van Rijn  ---
Created attachment 45545
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45545&action=edit
Tarball containing intermediate asm (with -dp) for each of 5 cases.

[Bug libgcc/89012] New: SH2 (FDPIC) duplicate symbols in generated assembly.

2019-01-23 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89012

Bug ID: 89012
   Summary: SH2 (FDPIC) duplicate symbols in generated assembly.
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgcc
  Assignee: unassigned at gcc dot gnu.org
  Reporter: me at zv dot io
  Target Milestone: ---

Code generated by gcc targeting `sh2eb-linux-musl` occasionally
contains duplicate symbols with optimization level `O2` or above
and produces the following errors during assembly:

$ gcc -c -mfdpic -O2 -Wno-int-conversion mintest.c
mintest.s: Assembler messages:
mintest.s:44: Error: symbol `.LPCS0' is already defined

This also occurs when the target is `sh2-linux-musl` but when it
specifically does not target `sh4` (even FDPIC). It does not
occur at optimization levels `O0` or `O1`.

I am using GCC with the following configuration, however, this
may also occur with 7.3.0 (unverified):

GCC  : 8.2.0
binutils : 2.31.1
musl : git-39ef61 (2018-11-19)

a minimal test case:

/* mintest.c */
int a, b, c, d;
int *e = (void *)0;
void f ()
{
for (; d;)
{
if (b) c = a;
e = e[0] = 1 << c;
}
}

the assembly contains:

.LPCS0:
mov.l   @r2,r0
mov.l   r0,@r1
mov.l   @r3,r2
tst r2,r2
bt.s.L5
mov r0,r1
.LPCS0:
mov.l   r0,@r2
mov.l   r0,@r1
mov.l   @r3,r2
tst r2,r2
bf.s.L2
mov r0,r1

I could not reproduce this under 6.4.0 or 7.3.0 with binutils of
2.30 (the .LPCS0 sections are not present in the assembly).

[Bug fortran/87438] New: ICE building gfortran for MicroBlaze target

2018-09-25 Thread me at zv dot io
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87438

Bug ID: 87438
   Summary: ICE building gfortran for MicroBlaze target
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: me at zv dot io
  Target Milestone: ---

Created attachment 44752
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44752&action=edit
Build log with -j1 for clarity.

Attempting to build GCC 8.2.0 with the following flags for the MicroBlaze
target:

--enable-languages=c,c++,fortran --disable-libquadmath
--disable-libquadmath-support --disable-decimal-float --disable-multilib

Results in the following ICE:

mv -f .deps/bessel_r4.Tpo .deps/bessel_r4.Plo
/bin/sh ./libtool  --tag=CC   --mode=compile
/kale/musl-cross-make/build/local/microblaze-linux-musl/obj_gcc/./gcc/xgcc
-B/kale/musl-cross-make/build/local/microblaze-linux-musl/obj_gcc/./gcc/
-B/microblaze-linux-musl/bin/ -B/microblaze-linux-musl/lib/ -isystem
/microblaze-linux-musl/include -isystem /microblaze-linux-musl/sys-include
--sysroot=/kale/musl-cross-make/build/local/microblaze-linux-musl/obj_sysroot
-fdebug-prefix-map=/kale/musl-cross-make/build/local/microblaze-linux-musl= 
-DHAVE_CONFIG_H -I. -I../../../src_gcc/libgfortran 
-iquote../../../src_gcc/libgfortran/io -I../../../src_gcc/libgfortran/../gcc
-I../../../src_gcc/libgfortran/../gcc/config  -I../.././gcc
-I../../../src_gcc/libgfortran/../libgcc -I../libgcc
-I../../../src_gcc/libgfortran/../libbacktrace -I../libbacktrace
-I../libbacktrace  -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -Wextra -Wwrite-strings
-Werror=implicit-function-declaration -Werror=vla  -fcx-fortran-rules
-ffunction-sections -fdata-sections   -g -O2 -MT bessel_r8.lo -MD -MP -MF
.deps/bessel_r8.Tpo -c -o bessel_r8.lo `test -f
'../../../src_gcc/libgfortran/generated/bessel_r8.c' || echo
'../../../src_gcc/libgfortran/'`../../../src_gcc/libgfortran/generated/bessel_r8.c
libtool: compile: 
/kale/musl-cross-make/build/local/microblaze-linux-musl/obj_gcc/./gcc/xgcc
-B/kale/musl-cross-make/build/local/microblaze-linux-musl/obj_gcc/./gcc/
-B/microblaze-linux-musl/bin/ -B/microblaze-linux-musl/lib/ -isystem
/microblaze-linux-musl/include -isystem /microblaze-linux-musl/sys-include
--sysroot=/kale/musl-cross-make/build/local/microblaze-linux-musl/obj_sysroot
-fdebug-prefix-map=/kale/musl-cross-make/build/local/microblaze-linux-musl=
-DHAVE_CONFIG_H -I. -I../../../src_gcc/libgfortran
-iquote../../../src_gcc/libgfortran/io -I../../../src_gcc/libgfortran/../gcc
-I../../../src_gcc/libgfortran/../gcc/config -I../.././gcc
-I../../../src_gcc/libgfortran/../libgcc -I../libgcc
-I../../../src_gcc/libgfortran/../libbacktrace -I../libbacktrace
-I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -Wextra -Wwrite-strings
-Werror=implicit-function-declaration -Werror=vla -fcx-fortran-rules
-ffunction-sections -fdata-sections -g -O2 -MT bessel_r8.lo -MD -MP -MF
.deps/bessel_r8.Tpo -c ../../../src_gcc/libgfortran/generated/bessel_r8.c 
-fPIC -DPIC -o .libs/bessel_r8.o
during RTL pass: reload
../../../src_gcc/libgfortran/generated/bessel_r8.c: In function 'bessel_yn_r8':
../../../src_gcc/libgfortran/generated/bessel_r8.c:178:1: internal compiler
error: in gen_reg_rtx, at emit-rtl.c:1155
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.

Host compiler flags:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-foxkit-linux-musl/6.4.0/lto-wrapper
Target: x86_64-foxkit-linux-musl
Configured with: /usr/src/packages/system/gcc/src/gcc-6.4.0/configure
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--build=x86_64-foxkit-linux-musl --host=x86_64-foxkit-linux-musl
--target=x86_64-foxkit-linux-musl --with-pkgversion='Adelie 6.4.0'
--with-bugurl=http://bts.adelielinux.org/ --enable-checking=release
--disable-fixed-point --disable-libstdcxx-pch --disable-multilib
--disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie
--enable-cloog-backend --enable-languages=c,c++,objc,java,go,fortran
--disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared
--enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
gcc version 6.4.0 (Adelie 6.4.0)

Intermediate compiler flags:

$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: microblaze-linux-musl
Configured with: ../src_gcc/configure --enable-languages=c,c++ CC='gcc -static
--static' CXX='g++ -static --static' FC='gfortran -static --static' CFLAGS='-g0
-Os' CXXFLAGS='-g0 -Os' FFLAGS='-g0 -Os' LDFLAGS='-s -static --static'
--disable-nls MAKEINFO=/bin/false
--with-debug-prefix-map=/kal