https://sourceware.org/bugzilla/show_bug.cgi?id=32516
Bug ID: 32516 Summary: [RISCV] No compressed c.j for offsets of -2044, -2046, -2048 Product: binutils Version: 2.44 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: tommy_murphy at hotmail dot com Target Milestone: --- Created attachment 15870 --> https://sourceware.org/bugzilla/attachment.cgi?id=15870&action=edit cj.S - test case Originally reported here: https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1647 and then incorrectly logged by me against GCC here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118284 See the attached simple test code cj.S - note the "Goto +..." comments for how to adjust the offset between 2040 and 2048 in increments of 2 bytes. For offsets of up to -2040 and also -2042 a 16-bit compressed c.j <offset> is generated but for offsets of -2044, -2046 and -2048 a 32-bit (non-compressed) jal x0, <offset> instruction is generated. Is this an offset edge case error in the code generation or is there some other explanation for this behaviour that means that this behaviour is actually expected? If any further information or clarification is needed please let me know. Thanks! :-) Tested with riscv-gnu-toolchain GCC 14.2.0 and Binutils master branch at commit abbdd7248999ad66c0b59aa9656866ee1931b913. git clone https://github.com/riscv-collab/riscv-gnu-toolchain cd riscv-gnu-toolchain git clone https://github.com/bminor/binutils-gdb binutils-upstream-master --depth=1 ./configure --prefix=`pwd`/installed-tools --disable-gdb --with-binutils-src=`pwd`/binutils-upstream-master make ./riscv64-unknown-elf-gcc -v Using built-in specs. COLLECT_GCC=./riscv64-unknown-elf-gcc COLLECT_LTO_WRAPPER=/home/user/issue-1647/installed-tools/libexec/gcc/riscv64-unknown-elf/14.2.0/lto-wrapper Target: riscv64-unknown-elf Configured with: /home/user/issue-1647/gcc/configure --target=riscv64-unknown-elf --prefix=/home/user/issue-1647/installed-tools --disable-shared --disable-threads --enable-languages=c,c++ --with-pkgversion=g04696df09 --with-system-zlib --enable-tls --with-newlib --with-sysroot=/home/user/issue-1647/installed-tools/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=.././gcc --disable-multilib --with-abi=lp64d --with-arch=rv64gc --with-tune=rocket --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-Os -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medlow' Thread model: single Supported LTO compression algorithms: zlib gcc version 14.2.0 (g04696df09) -- You are receiving this mail because: You are on the CC list for the bug.