diff options
author | Dimitar Dimitrov <dimitar@dinux.eu> | 2025-08-16 20:30:14 -0600 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2025-08-16 20:30:14 -0600 |
commit | 14b15a9a473fc69b0251e625c397e70c396f0c0c (patch) | |
tree | f8b152ceece33dda4d6f2169e167032685867114 /libjava/classpath/lib | |
parent | 38e8115dd2bfaa05146f8d085106189f46c25f52 (diff) | |
download | gcc-14b15a9a473fc69b0251e625c397e70c396f0c0c.zip gcc-14b15a9a473fc69b0251e625c397e70c396f0c0c.tar.gz gcc-14b15a9a473fc69b0251e625c397e70c396f0c0c.tar.bz2 |
[PATCH] RISC-V: Fix block matching in arch-canonicalize [PR121538]
Commit r16-3028-g0c517ddf9b136c introduced parsing of conditional blocks
in riscv-ext*.def. For simplicity, it used a simple regular expression
to match the C++ lambda function for each condition. But the regular
expression is too simple - it matches only the first scoped code block,
without any trailing closing braces.
The "c" dependency for the "zca" extension has two code blocks inside
its conditional. One for RV32 and one for RV64. The script matches
only the RV32 block, and leaves the RV64 one. Any strings left, in turn,
are considered a list of non-conditional extensions. Thus the quoted
strings "d" and "zcd" from that block are taken as "simple" (non-conditional)
dependencies:
if (subset_list->xlen () == 64)
{
if (subset_list->lookup ("d"))
return subset_list->lookup ("zcd");
As a result, arch-canonicalize erroneously adds "d" extension:
$ ./config/riscv/arch-canonicalize rv32ec
rv32efdc_zicsr_zca_zcd_zcf
Before r16-3028-g0c517ddf9b136c the command returned:
$ ./config/riscv/arch-canonicalize rv32ec
rv32ec
Fix by extending the conditional block match until the number of opening
and closing braces is equal. This change might seem crude, but it does
save us from introducing a full C++ parser into the simple
arch-canonicalize python script. With this patch the script now
returns:
$ ./config/riscv/arch-canonicalize rv32ec
rv32ec_zca
Ok for trunk?
PR target/121538
gcc/ChangeLog:
* config/riscv/arch-canonicalize (parse_dep_exts):
Match condition block up to closing brace.
(test_parse_long_condition_block): New test.
Diffstat (limited to 'libjava/classpath/lib')
0 files changed, 0 insertions, 0 deletions