From nobody Fri May 31 22:28:48 2024 X-Original-To: toolchain@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vrd7j1N8pz5LXbG for ; Fri, 31 May 2024 22:28:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vrd7j0HPtz4hmC for ; Fri, 31 May 2024 22:28:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717194529; a=rsa-sha256; cv=none; b=DUW1ogBG/xdt3wurRpQpu7yNnxaTSOJFX3ZbSVG4ub+EmvUIsDSHffh6N1nlgo/dayCBrR dQlQGFm1Ak8gKodLfpzPo560wSl0klfJPxGip4WgBW48pyPdTrEgWcUNd/sRNcSPqJDJxD 4z9aUsFkzHVtdXP2LK4KfAso7HJ4iqZx02q6vvmgohrtQk6+LcdP+uDj96Q8zZ3NlltOa/ eY7YpG6mKpz1t5FzjvqCnmR+zWgt0kTzMy2ZT9zW7oh4vUEpVaW67tNNAhTa+9LaUpYf7h PDSw3jF8Baqo3bq5T0vXj7XnzCmkJ0DkI8G2+FcCxRfI7uohBLW54BuAGSupGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717194529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/1ZqNLRRfyBCRaz95ZHCGQOwXOECEuZSI6w+4aUAPM=; b=eqJNCEjjKt0hirk8sNe7aK6O/A6kI/hJZ7f/1YPasZOfmvAuuQy/ZqEbp11J8ZFZdck80o ndO9MC4fIRaoL/H9TJ9AceiJXcxJo2D8LDtrHOFibSntsSJdaH1To8yfGmC32snVBbg4dc TroAKaXLOnwZ+Ju3Y4JljnG+JXnLnR/PtbBF1d1W4Sjv+59mYZ6lkMV8eS+0TTeYJMEh4S +cJRkFXQaUzih1eRauL/ojXArax2Hgr+UD/ZWGDELYHh386YsO11ZIDHQn1SP7lHhHEGlA dMKD0NAXvbU2dCWeHHd54++Yqv0+sJ11rfHViPKrmlMvkWyyEsqvo3VYGs89mQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vrd7h6sb2zhX9 for ; Fri, 31 May 2024 22:28:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 44VMSmtn085440 for ; Fri, 31 May 2024 22:28:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 44VMSmPU085439 for toolchain@FreeBSD.org; Fri, 31 May 2024 22:28:48 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 279443] LIBCPP assertions are enabled in optimized builds when -DNDEBUG is given to clang Date: Fri, 31 May 2024 22:28:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 14.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: marklmi26-fbsd@yahoo.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: toolchain@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Maintenance of FreeBSD s integrated toolchain List-Archive: https://lists.freebsd.org/archives/freebsd-toolchain List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-toolchain@freebsd.org Sender: owner-freebsd-toolchain@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D279443 Mark Millard changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marklmi26-fbsd@yahoo.com --- Comment #1 from Mark Millard --- I tried the code that is based on: std::copy( &buf[0], &buf[cb], // !!! ASSERTs HERE !!! std::back_inserter(r) ); via: # c++ -g get_executable_filename.cpp # gdb a.out . . . Reading symbols from a.out... (gdb) run Starting program: /usr/home/root/c_tests/a.out=20 Program received signal SIGILL, Illegal instruction. Privileged opcode. 0x0000000000203faa in std::__1::vector >::operator[][abi:se180100](unsigned long) (this=3D0x7fffffffe940, __n=3D29= ) at /usr/include/c++/v1/vector:1393 1393 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index= out of bounds"); Then I tried that sequence based on: std::copy( &buf[0], //&buf[cb], // !!! ASSERTs HERE !!! &buf[0] + cb,=20 std::back_inserter(r) ); # c++ -g get_executable_filename.cpp # gdb a.out . . . Reading symbols from a.out... (gdb) run Starting program: /usr/home/root/c_tests/a.out=20 /usr/home/root/c_tests/a.out [Inferior 1 (process 66199) exited normally] I'm not so sure that C++ defines &buf[cb] as equivalent to &buf[0] + cb for std::contiguous_iterator contexts relative to all issues. cppreference.com reports for std::contiguous_iterator : QUOTE Semantic requirements Let a and b be dereferenceable iterators and c be a non-dereferenceable iterator of type I such that b is reachable from a and c is reachable from = b. The type I models contiguous_iterator only if all the concepts it subsumes = are modeled and: std::to_address(a) =3D=3D std::addressof(*a), std::to_address(b) =3D=3D std::to_address(a) + std::iter_difference_t(b = - a), and std::to_address(c) =3D=3D std::to_address(a) + std::iter_difference_t(c = - a). END QUOTE &buf[0] + cb notation does avoid any suggestion of dereferencing buf[cb] at any stage. --=20 You are receiving this mail because: You are the assignee for the bug.=