Go to file
Jakub Jelinek 53bb714513 libiberty: Fix up libiberty_vprintf_buffer_size
When writing the HOST_SIZE_T_PRINT_UNSIGNED incremental patch,
my first bootstrap failed on i686-linux.  That is because I've also had
@@ -1344,8 +1344,10 @@ adjust_field_rtx_def (type_p t, options_
            }

          subfields = create_field (subfields, t,
-                                   xasprintf (".fld[%lu].%s",
-                                              (unsigned long) aindex,
+                                   xasprintf (".fld["
+                                              HOST_SIZE_T_PRINT_UNSIGNED
+                                              "].%s",
+                                              (fmt_size_t) aindex,
                                               subname));
          subfields->opt = nodot;
          if (t == note_union_tp)
hunk in gengtype.cc.  While sprintf obviously can print in this case %llu
with fmt_size_t being unsigned long long (that is another bug I'll fix
incrementally), seems libiberty_vprintf_buffer_size
can't deal with that, it ignores h, hh, l, ll and L modifiers and
unconditionally, estimates 30 chars as upper bounds for integers (that is
fine) and then uses (void) va_arg (ap, int); to skip over the argument
regardless if it was %d, %ld, %lld, %hd, %hhd etc.
Now, on x86_64 that happens to work fine probably for all of those,
on ia32 for everything but %lld, because it then skips just one half
of the long long argument; now as there is %s after it, it will try to
compute strlen not from the pointer argument corresponding to %s, but
from the most significant half of the previous long long argument.

So, the following patch attempts not to completely ignore the modifiers,
but figure out from them whether to va_arg an int (used for h and hh as
well), or long, or long long, or size_t, or ptrdiff_t - added support for
z and t there, plus for Windows I64.  And also %Lf etc. for long double.

2024-02-12  Jakub Jelinek  <jakub@redhat.com>

	* vprintf-support.c (libiberty_vprintf_buffer_size): Handle
	properly l, ll, z, t or on _WIN32 I64 modifiers for diouxX
	and L modifier for fFgGeE.
2024-02-12 18:50:16 +01:00
.github
c++tools
config
contrib
fixincludes
gcc d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125] 2024-02-12 17:06:41 +01:00
gnattools
gotools
include
INSTALL
libada
libatomic
libbacktrace
libcc1 Daily bump. 2024-02-10 00:17:14 +00:00
libcody
libcpp
libdecnumber
libffi
libgcc x86, libgcc: Implement ia32 basic heap trampoline [PR113855]. 2024-02-12 15:03:12 +00:00
libgfortran
libgm2 libgm2: Define missing configure macros [PR113888] 2024-02-12 14:01:41 +01:00
libgo
libgomp libgomp: testsuite: Don't XPASS libgomp.c/alloc-pinned-1.c etc. on non-Linux targets [PR113448] 2024-02-12 14:44:17 +01:00
libgrust
libiberty libiberty: Fix up libiberty_vprintf_buffer_size 2024-02-12 18:50:16 +01:00
libitm
libobjc
libphobos libphobos: Bump soname version to 5 [PR113667] 2024-02-12 17:06:47 +01:00
libquadmath
libsanitizer
libssp
libstdc++-v3 Daily bump. 2024-02-10 00:17:14 +00:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2024-02-11 00:17:01 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS Add Myself to Write After Approval and DCO List 2024-02-10 12:49:29 -06:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.