> So OK with the two whitespace fixes. Thanks Jeff, will commit with the whitespace fixes.
Pan -----Original Message----- From: Jeff Law <jeffreya...@gmail.com> Sent: Tuesday, February 18, 2025 2:00 PM To: Li, Pan2 <pan2...@intel.com>; gcc-patches@gcc.gnu.org Cc: juzhe.zh...@rivai.ai; kito.ch...@gmail.com; rdapp....@gmail.com Subject: Re: [PATCH v1] RISC-V: Fix ICE for target attributes has different xlen size On 2/14/25 11:33 PM, pan2...@intel.com wrote: > From: Pan Li <pan2...@intel.com> > > This patch would like to avoid the ICE when the target attribute > specific the xlen different to the cmd. Aka compile with rv64gc > but target attribute with rv32gcv_zbb. For example as blow: > > 1 │ long foo (long a, long b) > 2 │ __attribute__((target("arch=rv32gcv_zbb"))); > 3 │ > 4 │ long foo (long a, long b) > 5 │ { > 6 │ return a + (b * 2); > 7 │ } > > when compile with rv64gc -O3, it will have ICE similar as below > > during RTL pass: fwprop1 > test.c: In function ‘foo’: > test.c:10:1: internal compiler error: in add_use, at > rtl-ssa/accesses.cc:1234 > 10 | } > | ^ > 0x44d6b9d internal_error(char const*, ...) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/diagnostic-global-context.cc:517 > 0x44a26a6 fancy_abort(char const*, int, char const*) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/diagnostic.cc:1722 > 0x408fac9 rtl_ssa::function_info::add_use(rtl_ssa::use_info*) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/accesses.cc:1234 > 0x40a5eea > rtl_ssa::function_info::create_reg_use(rtl_ssa::function_info::build_info&, > rtl_ssa::insn_info*, rtl_ssa::resource_info) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/insns.cc:496 > 0x4456738 > rtl_ssa::function_info::add_artificial_accesses(rtl_ssa::function_info::build_info&, > df_ref_flags) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/blocks.cc:900 > 0x4457297 > rtl_ssa::function_info::start_block(rtl_ssa::function_info::build_info&, > rtl_ssa::bb_info*) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/blocks.cc:1082 > 0x4453627 > rtl_ssa::function_info::bb_walker::before_dom_children(basic_block_def*) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/blocks.cc:118 > 0x3e9f3fb dom_walker::walk(basic_block_def*) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/domwalk.cc:311 > 0x445806f rtl_ssa::function_info::process_all_blocks() > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/blocks.cc:1298 > 0x40a22d3 rtl_ssa::function_info::function_info(function*) > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/rtl-ssa/functions.cc:51 > 0x3ec3f80 fwprop_init > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/fwprop.cc:893 > 0x3ec420d fwprop > > /home/pli/gcc/111/riscv-gnu-toolchain/gcc/__RISC-V_BUILD__/../gcc/fwprop.cc:963 > 0x3ec43ad execute > > Consider stage 4, we just report error for the above scenario when > detect the cmd xlen is different to the target attribute during the > target hook TARGET_OPTION_VALID_ATTRIBUTE_P implementation. > > PR target/118540 > > gcc/ChangeLog: > > * config/riscv/riscv-target-attr.cc > (riscv_target_attr_parser::parse_arch): > Report error when cmd xlen is different with target attribute. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/rvv/base/pr118540-1.c: New test. > * gcc.target/riscv/rvv/base/pr118540-2.c: New test. Just whitespace nits caught be the linter. > { > + if (TARGET_64BIT && strncmp ("32", str + 2, strlen("32")) == 0) Space betwen the strlen and the open paren. > + if (!TARGET_64BIT && strncmp ("64", str + 2, strlen("64")) == 0) Similarly. I think the other linter warning is inside the diagnostic string and a false positive. So OK with the two whitespace fixes. jeff