diff options
| author | Alexandre Oliva <oliva@adacore.com> | 2025-12-06 20:11:42 -0300 |
|---|---|---|
| committer | Alexandre Oliva <oliva@gnu.org> | 2025-12-06 20:11:42 -0300 |
| commit | fb8a9da75a4962e2a79eef640364d2544b1319ee (patch) | |
| tree | cca5011d372fdde52d880223042230d1ce8d03a5 /gcc/fortran/expr.cc | |
| parent | 55d31324ac5c2763e9c9eb647c5ec068af24baf3 (diff) | |
| download | gcc-fb8a9da75a4962e2a79eef640364d2544b1319ee.zip gcc-fb8a9da75a4962e2a79eef640364d2544b1319ee.tar.gz gcc-fb8a9da75a4962e2a79eef640364d2544b1319ee.tar.bz2 | |
[riscv] avoid auipc overflow with large offsets [PR91420]
When computing an address plus a large offset on riscv64 with a
PC-relative sequence, we may hit the range limit for auipc and get a
relocation overflow, where on riscv32 the computation wraps around.
Since -mcmodel=medany requires the entire program to fit in a 2GiB
address range, a +/-1GiB+ offset added to an in-range symbol in a
barely-fitting program is more likely than not to be out-of-range.
Since such large constants are unlikely to come up by chance, separate
them from the symbol so as to avoid the relocation overflow.
for gcc/ChangeLog
PR target/91420
* config/riscv/riscv.cc (riscv_symbolic_constant_p): Require
offsets smaller than +/- 1GiB for PCREL symbols.
for gcc/testsuite/ChangeLog
PR target/91420
* gcc.target/riscv/pr91420.c: New.
Diffstat (limited to 'gcc/fortran/expr.cc')
0 files changed, 0 insertions, 0 deletions
