After this change:

  https://mail-index.netbsd.org/source-changes/2022/10/26/msg141745.html

The "NET4501" kernel build fails as shown below.  This is probably due
to "-Os" optimization causing GCC to be unable to grok the initialization
condition for "ctp".

[...]
#   compile  NET4501/subr_prf.o
/r0/build/current/tools/amd64/bin/i486--netbsdelf-gcc -msoft-float -mno-mmx 
-mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss 
-fno-delete-null-pointer-checks -g -Os -fstack-protector -Wstack-protector 
--param ssp-buffer-size=1 -fstack-usage -Wstack-usage=3584 -fno-strict-aliasing 
-fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length 
-Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition 
-Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code 
-Wno-pointer-sign -Wno-attributes -Wno-type-limits -Wextra 
-Wno-unused-parameter -Wold-style-definition -Wno-sign-compare -Walloca 
-Wno-address-of-packed-member --sysroot=/r0/build/current/DEST/i386 -Di386 -I. 
-I/x/current/src/sys/external/mit/xen-include-public/dist/ 
-I/x/current/src/sys/external/bsd/libnv/dist 
-I/x/current/src/sys/external/bsd/acpica/dist 
-I/x/current/src/sys/../common/lib/libx86emu 
-I/x/current/src/sys/../common/lib/libc/misc 
-I/x/current/src/sys/../common/include -I/x/current/src/sys/arch 
-I/x/current/src/sys -nostdinc -DCOMPAT_UTILS 
-D__XEN_INTERFACE_VERSION__=0x3020a -DTIMER_FREQ=1189200 -DCOMPAT_44 -D_KERNEL 
-D_KERNEL_OPT -std=gnu99 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/quad 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/string 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/atomic 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/hash/sha3 
-D_FORTIFY_SOURCE=2 -I/x/current/src/sys/external/isc/atheros_hal/dist 
-I/x/current/src/sys/external/isc/atheros_hal/ic 
-I/x/current/src/sys/external/bsd/libnv/dist -c 
/x/current/src/sys/kern/subr_prf.c -o subr_prf.o
/x/current/src/sys/kern/subr_prf.c: In function 'putone':
/x/current/src/sys/kern/subr_prf.c:427:23: error: 'ctp' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  427 |  if ((flags & TOCONS) && ctp == NULL && c != '\0')
cc1: all warnings being treated as errors

*** Failed target: subr_prf.o
*** Failed commands:
        ${NORMAL_C}
        => @echo '#  ' "compile  NET4501/subr_prf.o" &&  echo 
/r0/build/current/tools/amd64/bin/i486--netbsdelf-gcc   -msoft-float -mno-mmx 
-mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss  
-fno-delete-null-pointer-checks  -g -Os -fstack-protector -Wstack-protector   
--param ssp-buffer-size=1   -fstack-usage -Wstack-usage=3584  
-fno-strict-aliasing -fno-common     -std=gnu99   -Werror -Wall -Wno-main 
-Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes 
-Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual 
-Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes 
-Wno-type-limits -Wextra -Wno-unused-parameter -Wold-style-definition 
-Wno-sign-compare -Walloca   -Wno-address-of-packed-member    
--sysroot=/r0/build/current/DEST/i386 -Di386 -I. 
-I/x/current/src/sys/external/mit/xen-include-public/dist/ 
-I/x/current/src/sys/external/bsd/libnv/dist 
-I/x/current/src/sys/external/bsd/acpica/dist 
-I/x/current/src/sys/../common/lib/libx86emu 
-I/x/current/src/sys/../common/lib/libc/misc 
-I/x/current/src/sys/../common/include -I/x/current/src/sys/arch  
-I/x/current/src/sys -nostdinc -DCOMPAT_UTILS  
-D__XEN_INTERFACE_VERSION__="0x3020a"  -DTIMER_FREQ="1189200"  -DCOMPAT_44 
-D_KERNEL -D_KERNEL_OPT -std=gnu99 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/quad 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/string 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/atomic 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/hash/sha3   
-D_FORTIFY_SOURCE=2 -I/x/current/src/sys/external/isc/atheros_hal/dist 
-I/x/current/src/sys/external/isc/atheros_hal/ic 
-I/x/current/src/sys/external/bsd/libnv/dist -c 
/x/current/src/sys/kern/subr_prf.c -o subr_prf.o  &&  
/r0/build/current/tools/amd64/bin/i486--netbsdelf-gcc   -msoft-float -mno-mmx 
-mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss  
-fno-delete-null-pointer-checks  -g -Os -fstack-protector -Wstack-protector   
--param ssp-buffer-size=1   -fstack-usage -Wstack-usage=3584  
-fno-strict-aliasing -fno-common     -std=gnu99   -Werror -Wall -Wno-main 
-Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes 
-Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual 
-Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes 
-Wno-type-limits -Wextra -Wno-unused-parameter -Wold-style-definition 
-Wno-sign-compare -Walloca   -Wno-address-of-packed-member    
--sysroot=/r0/build/current/DEST/i386 -Di386 -I. 
-I/x/current/src/sys/external/mit/xen-include-public/dist/ 
-I/x/current/src/sys/external/bsd/libnv/dist 
-I/x/current/src/sys/external/bsd/acpica/dist 
-I/x/current/src/sys/../common/lib/libx86emu 
-I/x/current/src/sys/../common/lib/libc/misc 
-I/x/current/src/sys/../common/include -I/x/current/src/sys/arch  
-I/x/current/src/sys -nostdinc -DCOMPAT_UTILS  
-D__XEN_INTERFACE_VERSION__="0x3020a"  -DTIMER_FREQ="1189200"  -DCOMPAT_44 
-D_KERNEL -D_KERNEL_OPT -std=gnu99 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/quad 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/string 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/atomic 
-I/x/current/src/sys/lib/libkern/../../../common/lib/libc/hash/sha3   
-D_FORTIFY_SOURCE=2 -I/x/current/src/sys/external/isc/atheros_hal/dist 
-I/x/current/src/sys/external/isc/atheros_hal/ic 
-I/x/current/src/sys/external/bsd/libnv/dist -c 
/x/current/src/sys/kern/subr_prf.c -o subr_prf.o  &&  echo 
/r0/build/current/tools/amd64/bin/nbctfconvert -g -L VERSION -g subr_prf.o &&  
/r0/build/current/tools/amd64/bin/nbctfconvert -g -L VERSION -g subr_prf.o
*** [subr_prf.o] Error code 1

nbmake: stopped in /r0/build/current/obj/i386/sys/arch/i386/compile/NET4501
1 error

nbmake: stopped in /r0/build/current/obj/i386/sys/arch/i386/compile/NET4501

ERROR: Failed to make all in 
"/r0/build/current/obj/i386/sys/arch/i386/compile/NET4501"

*** BUILD ABORTED ***


Explicitly initializing "ctp = NULL;" after the declaration allows the
build to complete.

-- 
|/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
|\ / jdbaker[snail]consolidated[flyspeck]net  OpenBSD            FreeBSD
| X  No HTML/proprietary data in email.   BSD just sits there and works!
|/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

Reply via email to