NetBSD Problem Report #60317

From www@netbsd.org  Tue Jun  9 06:24:09 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8252E1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  9 Jun 2026 06:24:09 +0000 (UTC)
Message-Id: <20260609062408.623281A923B@mollari.NetBSD.org>
Date: Tue,  9 Jun 2026 06:24:08 +0000 (UTC)
From: bbartlomiej@gmail.com
Reply-To: bbartlomiej@gmail.com
To: gnats-bugs@NetBSD.org
Subject: build.sh distribution sets fails with -pipe -O2 in CPUFLAGS
X-Send-Pr-Version: www-1.0
X-From4GNATS: "bbartlomiej@gmail.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60317
>Category:       toolchain
>Synopsis:       build.sh distribution sets fails with -pipe -O2 in CPUFLAGS
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 09 06:25:01 +0000 2026
>Last-Modified:  Tue Jun 09 08:55:00 +0000 2026
>Originator:     Bart Krawczyk
>Release:        NetBSD 11.0_RC4
>Organization:
>Environment:
NetBSD vps 11.0_RC4 NetBSD 11.0_RC4 (GENERIC) #0: Tue May 12 04:23:51 UTC 2026  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
When I tried to build distribution sets to test the fix for PR 60292 the build failed with:

--- dependall-../crypto/external/bsd/openssh/lib ---
 --- kexmlkem768x25519.pico ---
 In file included from 
 /home/bartek/netbsd/src/crypto/external/bsd/openssh/dist/kexmlkem768x25519.c:46:
 /home/bartek/netbsd/src/crypto/external/bsd/openssh/dist/libcrux_mlkem768_sha3.h: 
 In function 'libcrux_ml_kem_ind_cpa_unpacked_default_8b_1b':
 /home/bartek/netbsd/src/crypto/external/bsd/openssh/dist/libcrux_mlkem768_sha3.h:8112:11: 
 error: array subscript '<unnamed-unsigned:256>[0]' is partly outside 
 array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds]
   8112 |   uint8_t uu____1[32U] = {0U};
        |           ^~~~~~~

 I used:

 ./build.sh -u -U -j6 tools distribution sets

 and my mk.conf:

 WRKOBJDIR=/var/tmp/pkg
 MAKE_JOBS=6
 CPUFLAGS+=-pipe -O2 -mtune=native -march=native
 PKG_DEFAULT_OPTIONS+= -avahi -pulseaudio -wayland dbus x11
 SKIP_LICENSE_CHECK= yes

It was suggested by Martin that it may be related to -pipe and that this should be raised as a separate PR.

After removing CPUFLAGS definition the build succeeded.

>How-To-Repeat:
- download clean netbsd-11-0-RC4 sources
- add -pipe -O2 to your CPUFLAGS in /etc/mk.conf
- build tools distribution sets with build.sh
>Fix:

>Audit-Trail:
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/60317: build.sh distribution sets fails with -pipe -O2
 in CPUFLAGS
Date: Tue, 9 Jun 2026 11:52:26 +0300

 On a tangent...  Adding flags like -pipe and/or -O2 to CPUFLAGS is a
 bad idea.  It's already a bit messy with the way COPTS is treated
 differently by the kernel and by the userland build machinery.  I'm
 pretty sure _some_ botloader builds massage build flags and you might
 get strange results when these two find each other.

 As far as I can tell the best way to express what you want is to set

   # should be COPTS in an ideal world, but that breaks the kernel makefile
   DBG = -pipe -O2

 and only set cpu-related flags in CPUFLAGS (that is passed e.g. to
 as(1) invocations)

   CPUFLAGS = -mtune=native -march=native

 -uwe

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.