perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

5.41.4: B::Deparse generates code which emits "Possible precedence problem between ! and numeric eq (==)" warning

Open eserte opened this issue 1 year ago • 1 comments

Module: B::Deparse

Description !$something == $else throws warnings with perl 5.41.x. B::Deparse may generate code which triggers this warning.

Steps to Reproduce Sample oneliner:

$ perl5.41.4 -w -MO=Deparse -e 'my $p; if ((!$p) == 1) { }' | perl5.41.4 -cw
-e syntax OK
Possible precedence problem between ! and numeric eq (==) at - line 3.
- syntax OK

Output produced by B::Deparse is here:

BEGIN { $^W = 1; }
my $p;
if (!$p == 1) {
    ();
}
-e syntax OK

Expected behavior B::Deparse should not drop the parentheses in this example

Perl configuration

Seen with normally compiled 5.41.4

eserte avatar Oct 12 '24 19:10 eserte

Module: B::Deparse

Description !$something == $else throws warnings with perl 5.41.x. B::Deparse may generate code which triggers this warning.

Steps to Reproduce Sample oneliner:

$ perl5.41.4 -w -MO=Deparse -e 'my $p; if ((!$p) == 1) { }' | perl5.41.4 -cw
-e syntax OK
Possible precedence problem between ! and numeric eq (==) at - line 3.
- syntax OK

[snip]

@mauke, do you have thoughts on this problem?

jkeenan avatar Oct 15 '24 01:10 jkeenan