[Bug target/94506] broken code generate on MIPS
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94506 Hauke Mehrtens changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #3 from Hauke Mehrtens --- This was not a bug in GCC, but in the kernel. The kernel was not taking care of hazards between mtc0 and mfc0, so a bit set in the c0_status register was overwritten later on. This problem only happened with some orderings of the instructions, this made it looks like it depends on the GCC version. See here for details: https://www.spinics.net/lists/stable/msg399099.html
[Bug tree-optimization/94506] New: broken code generate on MIPS
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94506 Bug ID: 94506 Summary: broken code generate on MIPS Product: gcc Version: 8.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: g...@hauke-m.de Target Milestone: --- Since we upgraded from GCC 8.3.0 to GCC 8.4.0 in OpenWrt the Linux kernel crashes on some ath79 (MIPS BE 74Kec) boards with such a error reproducible: [0.084927] pid_max: default: 32768 minimum: 301 [0.08] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) [0.097796] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) [0.107070] Kernel panic - not syncing: Unexpected DSP exception [0.113470] Rebooting in 1 seconds.. I bisected it to change r278587 in GCC. When I revert this change the kernel boot up fine. We see this problem only in the Linux kernel since this commit: https://git.kernel.org/linus/9012d011660ea5cf2a623e1de207a2bc0ca6936d I got reports of the same problem in GCC 9.2.0, in GCC 9.3.0 it works for me and others. Here is the related OpenWrt Ticket: https://bugs.openwrt.org/index.php?do=details_id=2928 Here is a Linux kernel binary compiled with GCC 8.4.0 https://hauke-m.de/files/vmlinux.debug-new-5.4-8.4.0.broken Here is a Linux kernel binary compiled with GCC 8.4.0 + r278587 reverted: https://hauke-m.de/files/vmlinux.debug-new-5.4-8.4.0.working I was unable to go into the details what is different between these two compiles.
[Bug target/91702] [9/10 Regression] ICE with mips16
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91702 --- Comment #2 from Hauke Mehrtens --- I backported https://gcc.gnu.org/viewcvs/gcc?view=revision=273174 on top of GCC 9.2.0 and I do not see this problem any more, OpenWrt compiles now file with these settings. Please backport this change to the gcc 9 branch.
[Bug target/91702] New: ICE with mips16
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91702 Bug ID: 91702 Summary: ICE with mips16 Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: g...@hauke-m.de Target Milestone: --- I am getting the following internal compiler error when building json-c-0.13.1 with GCC 9.2 for MIPS big endian with mip16 support. $ make V=s make all-recursive make[1]: Entering directory '/home/hauke/openwrt/dl/tmp/json-c-0.13.1' Making all in . make[2]: Entering directory '/home/hauke/openwrt/dl/tmp/json-c-0.13.1' /bin/sh ./libtool --tag=CC --mode=compile mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -mips16 -Wall -Werror -Wcast-qual -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -D_GNU_SOURCE -D_REENTRANT -MT json_object.lo -MD -MP -MF .deps/json_object.Tpo -c -o json_object.lo json_object.c libtool: compile: mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -mips16 -Wall -Werror -Wcast-qual -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -D_GNU_SOURCE -D_REENTRANT -MT json_object.lo -MD -MP -MF .deps/json_object.Tpo -c json_object.c -fPIC -DPIC -o .libs/json_object.o during RTL pass: mach json_object.c: In function 'json_object_int_inc': json_object.c:735:1: internal compiler error: Segmentation fault 735 | } | ^ 0xa1397f crash_signal /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/toplev.c:326 0xcd428e mips_split_move(rtx_def*, rtx_def*, mips_split_type, rtx_def*) /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/config/mips/mips.c:4871 0xe9cc20 gen_split_59(rtx_insn*, rtx_def**) /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/config/mips/mips.md:5248 0xeec295 split_3 /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/config/mips/mips.md:5246 0xeec295 split_insns(rtx_def*, rtx_insn*) /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/config/mips/mips.md:7019 0x72b189 try_split(rtx_def*, rtx_insn*, int) /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/emit-rtl.c:3851 0x9843d1 split_insn /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/recog.c:2901 0x988f67 split_all_insns_noflow() /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/recog.c:3063 0xccb594 mips16_lay_out_constants /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/config/mips/mips.c:17505 0xcd1765 mips_reorg /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/config/mips/mips.c:19380 0x9b1789 execute /home/hauke/openwrt/openwrt/build_dir/toolchain-mips_24kc_gcc-9.2.0_musl/gcc-9.2.0/gcc/reorg.c:3992 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://bugs.openwrt.org/> for instructions. make[2]: *** [Makefile:587: json_object.lo] Error 1 make[2]: Leaving directory '/home/hauke/openwrt/dl/tmp/json-c-0.13.1' make[1]: *** [Makefile:651: all-recursive] Error 1 make[1]: Leaving directory '/home/hauke/openwrt/dl/tmp/json-c-0.13.1' make: *** [Makefile:448: all] Error 2 - The problem is happening in this code part: https://github.com/json-c/json-c/blob/json-c-0.13.1-20180305/json_object.c#L735 I can reproduce it by using configure with these commands: CFLAGS="-mips16 " ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-pc-linux-gnu and then run make When I remove the -mips16 option from CFLAGS it compiles without an ICE. I am using GCC 9.2.0 from OpenWrt master as of today with the following patches applied: https://git.openwrt.org/?p=openwrt/openwrt.git;a=tree;f=toolchain/gcc/patches/9.2.0;h=81caffc170b7604a685785db350fa5b5e72baf63;hb=HEAD This was freshly compiled on a Arch Linux system which also uses GCC 9.2.0 as system compiler. OpenWrt uses binutils 2.32 I haven't seen this problem with GCC 7.4.0 and GCC 8.3.0, I am also not aware of any such bug report in OpenWrt. This is the OpenWrt configuration to reproduce this problem: -- [hauke@hauke-arch openwrt]$ ./scripts/diffconfig.sh CONFIG_TARGET_lantiq=y CONFIG_TARGET_lantiq_xrx200=y CONFIG_TARGET_lantiq_xrx200_Default=y CONFIG_DEVEL=y CONFIG_TOOLCHAINOPTS=y # CONFIG_BINUTILS_USE_VERSION_2_31_1 is not set CONFIG_BINUTILS_USE_VERSION_2_32=y CONFIG_BINUTILS_VERSION="2.32" CONFIG_BINUTILS_VERSION_2_32=y CONFIG_GCC_USE_EMBEDDED_PATH_REMAP=y # CONFIG_GCC_USE_VERSION_7 is not set CONFIG_GCC_USE_VERSION_9=y CONFIG_GCC_VERSION=&quo
[Bug target/83496] MIPS BE: wrong code generates under "-Os -mbranch-cost=1"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83496 --- Comment #5 from Hauke Mehrtens <g...@hauke-m.de> --- The description already contains the full function incl. 4006fc. Do you need more?
[Bug target/83496] MIPS BE: wrong code generates under "-Os -mbranch-cost=1"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83496 --- Comment #2 from Hauke Mehrtens <g...@hauke-m.de> --- Should I git bisect this or will someone else do this? If I should do that, is there some documentation on how to setup a test case and build and run this automatically?
[Bug target/83496] MIPS BE: wrong code generates under "-Os -mbranch-cost=1"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83496 --- Comment #1 from Hauke Mehrtens <g...@hauke-m.de> --- I only tested the GCC 7.X snapshot from 14. December 2017, not the GCC 8.X version.
[Bug target/83496] New: MIPS BE: wrong code generates under "-Os -mbranch-cost=1"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83496 Bug ID: 83496 Summary: MIPS BE: wrong code generates under "-Os -mbranch-cost=1" Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: g...@hauke-m.de Target Milestone: --- Created attachment 42924 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42924=edit Test case "mips-buildroot-linux-gnu-gcc test.c -o test2 -Os -mbranch-cost=1" generates wrong code for me. This was seen with GCC 7.2 for MIPS32 r2 BE in OpenWrt / LEDE and with the free electrons toolchain. I also tested the GCC snapshot from 14. December 2017 and saw the same problem. This is the code: int mytest(mp_int * a, mp_digit b) { /* compare based on sign */ if (a->sign == 1) { return -1; } /* compare based on magnitude */ if (a->used > 1) { return 1; } /* compare the only digit of a to b */ if (a->dp[0] > b) { return 1; } else if (a->dp[0] < b) { return -1; } else { return 0; } } This is the wrong ASM: 004006c0 : 4006c0: 8c830008lw v1,8(a0) 4006c4: 24020001li v0,1 4006c8: 1062000cbeq v1,v0,4006fc <mytest+0x3c> 4006cc: 2402li v0,-1 4006d0: 8c83lw v1,0(a0) 4006d4: 28630002sltiv1,v1,2 4006d8: 1068beqzv1,4006fc <mytest+0x3c> 4006dc: nop 4006e0: 8c82000clw v0,12(a0) 4006e4: 8c42lw v0,0(v0) 4006e8: 00a2182bsltuv1,a1,v0 4006ec: 1465bnezv1,400704 <mytest+0x44> 4006f0: nop 4006f4: 0045102bsltuv0,v0,a1 4006f8: 00021023neguv0,v0 4006fc: 03e8jr ra 400700: nop 400704: 03e8jr ra 400708: 24020001li v0,1 40070c: nop In line 4006dc it should say "li v0,1" instead of nop. This code will return -1 if "if (a->used > 1) " is true, but it should return 1. I have also attached the code and compiled it with: ~/mips32--glibc--bleeding-edge/bin/mips-buildroot-linux-gnu-gcc test.c -o test2 -Os -mbranch-cost=1 When I compile it without "-mbranch-cost=1" it generates correct code. When I use this it also generates correct code: ~/mips32--glibc--bleeding-edge/bin/mips-buildroot-linux-gnu-gcc test.c -o test4 -Os -mbranch-cost=1 -funroll-loops