Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126564 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 07C2F1A00BC for ; Tue, 4 Mar 2025 22:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741125975; bh=niNTY0O+ZCVATUVW3iO8e7q3poDnNKMTo2boIcC45YQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dXPbsQlWhhz5B/JOU1gXZ4FelaaRNlGrypaWLpHjg+/MQlb5En+G9Mn+sM59LSdVl OZmp6KtFlTfsWw02Nnnr9j9VeWbTkT4hYRHysybIDyzjkd7OZ8ILOrwuqnfx7jhiin SsRJzjsqJkwgfiFSNmaDSgHEod0Em3+s9pgLHQb12auchzIgtlu0wydhaNCc80dOXb vlqs6nNt+5s9zKRGlDPqxFb9id9jmVhot/sZHTeFhAwCxEKQ5Y7MeIAcv1peG2QzjR qjpZSJ8Iplg5lpbap7L4TlWdJoYMf7Dbm/d9UCdUM1dg3GQRkYkv6W2ekRUy35RtPd WDR8ydXVqDgAQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 731BF1801E0 for ; Tue, 4 Mar 2025 22:06:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (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) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 4 Mar 2025 22:06:14 +0000 (UTC) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-6ef9b8b4f13so52817087b3.2 for ; Tue, 04 Mar 2025 14:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741126129; x=1741730929; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=niNTY0O+ZCVATUVW3iO8e7q3poDnNKMTo2boIcC45YQ=; b=kH6qXEQvsIiXrTyePMdmEZx3aC57SpBZKJWWtSxCqGb9vtsjnSEQXOG8aGN8nm3I2I BOfRM7utgwZu67fedoXMxNGPNMo2JnOKE2nc2hR2dmbfvyxJNBwpnrT42AvTDMUK8zti m7dZphMU/3LAbDrYZQsSRToq5sgLLH8W701/I6tObnGNOB/07bTZ3EzTPlc39NtqjveT glBlpx4dH5Hq7MupcID0qDOug0j5hp1U/WaS+O/OtXdM13/1exWf3eQcy394e9lk+YID xPVK0aPMr0NwLptIR5AYIU1jxufxMu8eO9FsjNy6SEZUi14iyKB2+Kw0QCneglEosjBQ id6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741126129; x=1741730929; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=niNTY0O+ZCVATUVW3iO8e7q3poDnNKMTo2boIcC45YQ=; b=CGC/Ua2FxUwuP0i4/SzBrk7jMMuzqWnP90JSy3ANgwxG1QH/5wzLIVe3Zm7TJ4y006 1P00Ol2ErF9dEWeT0zPCk/ZS99adePZWbkR4qsl/kJyYURE/vc2+rZx0Nh4yZnWQRWjo 5b406vAg2WhBoV4t1fsSp7xyrRNsRbZwg38cLhUFvS6do+bvEtlMSWPwEVqwlGQA+m5L g4icW1cWrN9iPGa6kqnY7WKdssqCsC0ruvwIv7ZqiddI8nCa6jt0+NX4EKm3FQc3KGYf xMcoA3OkV6wR064FOY5PE14PB6JSgG0V0iTr7e73QggYq4M94ikVjm21ddidX4v9hzY4 SmYg== X-Forwarded-Encrypted: i=1; AJvYcCW6fXwDLraisLO6QruxjkafInCo/9vuKiOAM9bNfeqqZhH7z5ZAl84b6kYxlX9QesxHg/bSCwOpHnE=@lists.php.net X-Gm-Message-State: AOJu0YxnwlkFT2IDmJCTl6K1tSHvOh2WaC8Etiy6dsLGJFVcKyvM+9nl izu6ro/gzXxoKHzKWLqkK2wT/Rg8dZsQHIsW9EsP0AVcdN+nvCVVNXYi/M9utyHjU9lh/ENX7u7 bNrDOwu7UWrb1alYeLgANJwxyHH4Au4zlzO0= X-Gm-Gg: ASbGncskZ53biEWMAeMCeczTfxF+/mn4vLF3onGpPJoIo+fXr1Tc4WeB6IzbQ6aFstH +1FbykJtlkokyP1kEIXUQnj6NrrII7d6XY5ywe+Pr0BvIp+vXs5LhV0rkY7jVuw10WKiivUxxQC AC0cSBKY1o+P88MnaEyLL9+ffbfw== X-Google-Smtp-Source: AGHT+IG16SFh2l3p9JtFUGibCU9506k+dD6ZIj4jTs7c07VNsB0SBeFSLOw9XmoZxf1BUvpz+JVka6dk5IaS2eCmjnA= X-Received: by 2002:a05:690c:6112:b0:6fd:a226:fb6f with SMTP id 00721157ae682-6fda2f13affmr15665707b3.8.1741126129386; Tue, 04 Mar 2025 14:08:49 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <55b798d4-dcd7-4d81-852b-b78294cdc39d@email.android.com> <1a980468-c5f3-485b-9e8b-8c97d6ac4802@bastelstu.be> In-Reply-To: <1a980468-c5f3-485b-9e8b-8c97d6ac4802@bastelstu.be> Date: Tue, 4 Mar 2025 23:08:36 +0100 X-Gm-Features: AQ5f1JrRDxdd_uaf5efxz3cub6uLIeiD6a0CGo-Ux7cTuuM8dTzCcJm5WlBv380 Message-ID: Subject: Re: [PHP-DEV] Re: RFC: Marking return values as important (#[\NoDiscard]) To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: "Marc B." , Volker Dusch , php internals Content-Type: multipart/alternative; boundary="000000000000738ea3062f8b8418" From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000738ea3062f8b8418 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Tim, On Tue, Mar 4, 2025, 22:16 Tim D=C3=BCsterhus wrote: > Hi Marc > > Should the `(void)` cast not be accepted, we will only special case the > assignment to `$_` to not be elided, even if OPcache knows that the > function will never return an object. The behavior for other variables > will remain unchanged. X Just asking, as my engine knowledge is a bit limited, Wouldn't it be possible that when OPcache would optimize away the unused variable assigned to a function, it could detect that that function have the NoDiscard attribute and also remove the attribute effect (warning triggering). Or identify that the function has the NoDiscard attribute and based on that do not optimize away the variable? -- Alex --000000000000738ea3062f8b8418 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Tim,

On Tue, Mar 4, 2025, 22:1= 6 Tim D=C3=BCsterhus <tim@bastelstu.= be> wrote:
Hi Marc

Should the `(void)` cast not be accepted, we will only special case the assignment to `$_` to not be elided, even if OPcache knows that the
function will never return an object. The behavior for other variables
will remain unchanged.
X

Just ask= ing, as my engine knowledge is a bit limited,
Wouldn= 't it be possible that when OPcache would optimize away the unused vari= able assigned to a function, it could detect that that function have the No= Discard attribute and also remove the attribute effect (warning triggering)= .
Or identify that the function has the NoDiscard at= tribute and based on that do not optimize away the variable?

--
Alex
<= div dir=3D"auto">
--000000000000738ea3062f8b8418--