NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/49281: amd64 kernel config w/ppbus and "options DEBUG_1284" build fails with format error



>Number:         49281
>Category:       kern
>Synopsis:       amd64 kernel config w/ppbus and "options DEBUG_1284" build fails with format error
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 14 00:30:00 +0000 2014
>Originator:     John D. Baker
>Release:        NetBSD/amd64-7.0_BETA (and 6.x)
>Organization:
>Environment:
NetBSD tesla.clamp.net 7.0_BETA NetBSD 7.0_BETA (GENERIC) #8: Mon Sep 29 19:49:05 CDT 2014  sysop%verthandi.technoskunk.fur@localhost:/d0/build/netbsd-7/obj/amd64/sys/arch/amd64/compile/GENERIC amd64

>Description:
Compiling a custom kernel with atppc/ppbus and "options DEBUG_1284"
fails as follows:

[...]
--- ppbus_base.o ---
/d0/nbsd/netbsd-7/src/sys/dev/ppbus/ppbus_base.c: In function 'ppbus_pnp_detect':
/d0/nbsd/netbsd-7/src/sys/dev/ppbus/ppbus_base.c:540:2: error: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Werror=format=]
  printf("%s: <PnP> %d characters: ", device_xname(dev), len);
  ^
cc1: all warnings being treated as errors
*** [ppbus_base.o] Error code 1

nbmake: stopped in /d0/build/netbsd-7/obj/amd64/sys/arch/amd64/compile/TESLA
1 error

nbmake: stopped in /d0/build/netbsd-7/obj/amd64/sys/arch/amd64/compile/TESLA

ERROR: Failed to make all in "/d0/build/netbsd-7/obj/amd64/sys/arch/amd64/compile/TESLA"
*** BUILD ABORTED ***


The referenced file/line is as follows:

539  #ifdef DEBUG_1284
540          printf("%s: <PnP> %d characters: ", device_xname(dev), len);
541          for (i = 0; i < len; i++)
542                  printf("%c(0x%x) ", str[i], str[i]);
543          printf("\n");
544  #endif

Firstly, I would question the use of "%d" (signed quantity) for
printing a size or length value.

Second, since this does not cause an error on i386, "size_t" would
seem to be compatible with "int" (32 bits) on that platform.

Presumedly, "size_t" is 64 bits on x86_64/amd64 (I'm lost in a sea of
typedefs tracking it down).

Is there a format specifier that will be interpreted correctly for
a variable of type "size_t" regardless of the underlying type?

>How-To-Repeat:
Create a kernel config for amd64 which includes:

  atppc* at <parent>
  ppbus* at atppc?
  options DEBUG_1284

Attempt to build said kernel.
>Fix:
Workaround:  don't use "options DEBUG_1284"



Home | Main Index | Thread Index | Old Index