This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/37080] vasprintf in libiberty fails for %llu on solaris
- From: "mark at easterbrook dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Dec 2008 10:51:20 -0000
- Subject: [Bug other/37080] vasprintf in libiberty fails for %llu on solaris
- References: <bug-37080-9617@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from mark at easterbrook dot org dot uk 2008-12-23 10:51 -------
The follow fixes it. Tested on several Solaris variants:
Patch to libiberty/vasprintf.c:
*** 79,84 ****
--- 79,85 ----
{
if (*p++ == '%')
{
+ int longs = 0;
while (strchr ("-+ #0", *p))
++p;
if (*p == '*')
***************
*** 100,106 ****
--- 101,111 ----
total_width += strtoul (p, (char **) &p, 10);
}
while (strchr ("hlL", *p))
+ {
+ if (*p=='l' || *p=='L')
+ longs++;
++p;
+ }
/* Should be big enough for any format specifier except %s and
floats. */
total_width += 30;
switch (*p)
***************
*** 112,118 ****
case 'x':
case 'X':
case 'c':
! (void) va_arg (ap, int);
break;
case 'f':
case 'e':
--- 117,128 ----
case 'x':
case 'X':
case 'c':
! if (longs == 0)
! (void) va_arg (ap, int);
! else if (longs == 1)
! (void) va_arg (ap, long);
! else
! (void) va_arg (ap, long long);
break;
case 'f':
case 'e':
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37080