[Bug lto/122515] Integer overflow on i686 when getting offsets in large archives
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 18 12:55:40 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122515
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Siddhesh Poyarekar
<siddhesh@gcc.gnu.org>:
https://gcc.gnu.org/g:9fa75e41070ef8a55886657a07bf75bc1aca946f
commit r15-10527-g9fa75e41070ef8a55886657a07bf75bc1aca946f
Author: Siddhesh Poyarekar <siddhesh@gotplt.org>
Date: Mon Nov 3 17:02:00 2025 -0600
lto/122515: Fix archive offset types for i686
On i686, offsets into object archives could be 64-bit, but they're
inconsistently treated across the lto, which may sometimes result in
truncation of those offsets for large archives.
Use int64_t/off_t consistently across all uses of archive offsets to
make sure that they're always read and mapped correctly.
gcc/lto/ChangeLog
PR lto/122515
* lto.h (lto_section_slot): Set type of START to off_t.
* lto-common.cc (lto_read_section_data): Adjust.
* lto-object.cc (lto_obj_file_open): Set type of OFFSET to
int64_t.
gcc/ChangeLog
PR lto/122515
* lto-wrapper.cc (debug_objcopy): Set type of INOFF to int64_t.
(run_gcc): Set type of FILE_OFFSET to int64_t.
gcc/testsuite/ChangeLog
PR lto/122515
* lib/lto.exp (lto-build-archive): New procedure.
(lto-execute-1): Use it.
(lto-link-and-maybe-run, lto-get-options-main): Handle ar-link.
* gcc.dg/lto/pr122515_0.c: New test case.
* gcc.dg/lto/pr122515_1.c: New file.
* gcc.dg/lto/pr122515_2.c: Likewise.
* gcc.dg/lto/pr122515_3.c: Likewise.
* gcc.dg/lto/pr122515_4.c: Likewise.
* gcc.dg/lto/pr122515_5.c: Likewise.
* gcc.dg/lto/pr122515_6.c: Likewise.
* gcc.dg/lto/pr122515_7.c: Likewise.
* gcc.dg/lto/pr122515_8.c: Likewise.
* gcc.dg/lto/pr122515_9.c: Likewise.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
(cherry picked from commit 0013501e462bd362de50bbac71ea4c6c7528dc08)
More information about the Gcc-bugs
mailing list