Subject: port-alpha/6511: EGCS misinterprets %uq on Alpha; ipnat won't build.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tls@rek.tjls.com>
List: netbsd-bugs
Date: 11/29/1998 18:57:48
>Number:         6511
>Category:       port-alpha
>Synopsis:       EGCS misinterprets %uq as unsigned long long on Alpha
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 29 16:05:01 1998
>Last-Modified:
>Originator:     tls:*:666:0:Thor Lancelot Simon:/tmp:/bin/csh
>Organization:
The NyetBSD Project
>Release:        19981129
>Environment:
System: NetBSD rektory 1.3I NetBSD 1.3I (REKTORY) #4: Sat Nov 28 16:24:11 EST 1998 root@rektory:/usr/src/sys/arch/alpha/compile/REKTORY alpha

>Description:
	After updating to -current source as of 1998/11/19, a "make build"
        failed in usr.sbin/ipf/ipnat:

/usr/src/usr.sbin/ipf/ipnat/ipnat.c:313: warning: long long unsigned int format, u_quad_t arg (arg 2)
/usr/src/usr.sbin/ipf/ipnat/ipnat.c:313: warning: long long unsigned int format, u_quad_t arg (arg 3)
/usr/src/usr.sbin/ipf/ipnat/ipnat.c: In function `dostats':
/usr/src/usr.sbin/ipf/ipnat/ipnat.c:433: warning: long long unsigned int format, u_quad_t arg (arg 2)
/usr/src/usr.sbin/ipf/ipnat/ipnat.c:433: warning: long long unsigned int format, u_quad_t arg (arg 3)
*** Error code 1

Stop.
*** Error code 1

Stop.
*** Error code 1

Stop.
*** Error code 1

Stop.
*** Error code 1

Stop.

As it turned out, the printf format in question was *not* %ull, but %uq, and
the type of the argument was in fact u_quad_t.

Updating the compiler to 1998/11/29 did not help.  The following test program
demonstrates the problem.

>How-To-Repeat:
	Compile the following trivial program with gcc -Werror -Wall on an
	Alpha.

#include <stdio.h>
#include <sys/types.h>
main()
{
u_quad_t foo;
foo = 9999999999;

printf("%qu\n", foo);
}

>Fix:
	
>Audit-Trail:
>Unformatted: