[bug #58427] Cost-base optimiser breaks short-circuit evaluation

Bernhard Voelker <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.