[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #58427] Cost-base optimiser breaks short-circuit evaluation
From: |
Bernhard Voelker |
Subject: |
[bug #58427] Cost-base optimiser breaks short-circuit evaluation |
Date: |
Tue, 26 May 2020 03:03:56 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0 |
Update of bug #58427 (project findutils):
Status: None => In Progress
Assigned to: None => berny
_______________________________________________________
Follow-up Comment #2:
Thanks for the report.
I see the following problems:
* Using -O0 does not turn off arm-swapping completely for those who want that.
I suggest to change that so that -O0 skips arm-swapping.
* POSIX states for "expression [-a] expression" that "the second expression
shall not be evaluated if the first expression is false". The optimizer
violates this rule. Still, I think that CBO makes sense where no side effects
are known. I suggest to:
** default to level 0 when POSIXLY_CORRECT is set (overridable by the -O
option),
** fix cases like this reported one where later tests can have side effects
like EPERM.
* The documentation about the default -O level states wrongly that the default
level would be 1 while it is hard-coded to 2 in util.c:set_option_defaults().
* The packager cannot choose the default optimization level. I suggest a new
configure option to make this possible.
Finally:
* findutils uses _"optimize"_ vs. _"optimise"_ quite inconsistently in its
code and documentation, with the latter (British English) having more hits
than the former (American English). I suggest to harmonize in the one or the
other direction.
@James: WDYT?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58427>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/