This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][LTO][RFC] AR archive support for LTO
> SCNd64 is the correct usage for sscanf but can't we have a atoll for
> int64_t ? ÂOr rather why don't we use HWI here?
> On darwin with -Werror turned on I get the following error:
> /Users/apinski/src/local/gcc/gcc/lto/lto-elf.c:561:7: error: ISO C
> does not support the 'q' gnu_scanf length modifier
Is the attached patch OK?
Rainer, can you check that it fixes 41996.
> Thanks,
> Andrew Pinski
>
Thanks,
--
Rafael Ãvila de EspÃndola
diff --git a/gcc/lto/lto-elf.c b/gcc/lto/lto-elf.c
index ee587f7..a1ea884 100644
--- a/gcc/lto/lto-elf.c
+++ b/gcc/lto/lto-elf.c
@@ -553,13 +553,11 @@ lto_elf_file_open (const char *filename, bool writable)
}
else
{
- int64_t t;
fname = (char *) xmalloc (offset_p - filename + 1);
memcpy (fname, filename, offset_p - filename);
fname[offset_p - filename] = '\0';
offset_p++;
- sscanf(offset_p, "%" PRId64 , &t);
- offset = t;
+ offset = atoll(offset_p);
/* elf_rand expects the offset to point to the ar header, not the
object itself. Subtract the size of the ar header (60 bytes).
We don't uses sizeof (struct ar_hd) to avoid including ar.h */