From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2E5113858D33; Wed, 22 Nov 2023 02:25:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E5113858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700619928; bh=Zx3jkiq5rXnwL1qzxrdQ8Lmdsf0r/qoEkIA9RidkZCA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WXjau6D+ZF8Py6Rom9Ih8F8Bh5y74JTz1rlMMkXRw0ZovHWM1wS69I9aFvlclENVo U9+iZZc8jaQD4k0rG9fv/0IYRrNhfH4jCRYH1zQJfD40tueIxhp4GayDws/OPVMTet Mi7i96k7DNQlrY5LjfBQm5qEnzBBhGVMvoB456fE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111815] VAX: ICE in 'print_operand_address' while building 'elf_zstd_decompress' from libbacktrace/elf.c Date: Wed, 22 Nov 2023 02:25:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: build X-Bugzilla-Severity: blocker X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: macro at orcam dot me.uk X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111815 --- Comment #5 from CVS Commits --- The releases/gcc-11 branch has been updated by Maciej W. Rozycki : https://gcc.gnu.org/g:66a4094112c446ec16733c687e4b3813519da66b commit r11-11108-g66a4094112c446ec16733c687e4b3813519da66b Author: Maciej W. Rozycki Date: Wed Nov 22 01:27:02 2023 +0000 PR target/111815: VAX: Only accept the index scaler as the RHS operand = to ASHIFT As from commit 9df1ba9a35b8 ("libbacktrace: support zstd decompression") GCC for the `vax-netbsdelf' target fails to complete building, with an ICE: during RTL pass: final .../libbacktrace/elf.c: In function 'elf_zstd_decompress': .../libbacktrace/elf.c:5006:1: internal compiler error: in print_operand_address, at config/vax/vax.cc:514 5006 | } | ^ 0x1113df97 print_operand_address(_IO_FILE*, rtx_def*) .../gcc/config/vax/vax.cc:514 0x10c2489b default_print_operand_address(_IO_FILE*, machine_mode, rtx_d= ef*) .../gcc/targhooks.cc:373 0x106ddd0b output_address(machine_mode, rtx_def*) .../gcc/final.cc:3648 0x106ddd0b output_asm_insn(char const*, rtx_def**) .../gcc/final.cc:3505 0x106e2143 output_asm_insn(char const*, rtx_def**) .../gcc/final.cc:3421 0x106e2143 final_scan_insn_1 .../gcc/final.cc:2841 0x106e28e3 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*) .../gcc/final.cc:2887 0x106e2bf7 final_1 .../gcc/final.cc:1979 0x106e3c67 rest_of_handle_final .../gcc/final.cc:4240 0x106e3c67 execute .../gcc/final.cc:4318 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. This is due to combine producing an invalid address RTX: (plus:SI (ashift:SI (const_int 1 [0x1]) (reg:QI 3 %r3 [1232])) (reg/v:SI 10 %r10 [orig:736 weight_mask ] [736])) where the expression is ((1 << R3) + R10), which does not match a valid machine addressing mode. Consequently `print_operand_address' chokes. This can be reduced to the testcase included, where it triggers the same ICE in `p'. Preincrements are required so that their results land in registers and consequently an indexed addressing mode is tried or otherwise doing operations piecemeal on stack-based function arguments as direct input operands turns out more profitable in terms of RTX costs and the ICE is avoided. The ultimate cause has been commit c605a8bf9270 ("VAX: Accept ASHIFT in address expressions"), where a shift of an immediate value by a register has been mistakenly allowed as an index expression as if the shift operation was commutative such as multiplication is. So with ASHIFT the scaler in an index expression has to be the right-hand operand, and the backend has to enforce that, whereas with MULT the scaler can be either operand. Fix this by only accepting the index scaler as the RHS operand to ASHIFT. gcc/ PR target/111815 * config/vax/vax.c (index_term_p): Only accept the index scaler as the RHS operand to ASHIFT. gcc/testsuite/ PR target/111815 * gcc.dg/torture/pr111815.c: New test. (cherry picked from commit 56ff988e6be3fdba70cad86d73ec0038bc3b6b5a)=