parrot/parrot — Issue #240: cond_eval in Parrot::Configure::Compiler is broken
Author: gerdr
Created: 2012-01-13 19:03:22+00:00
State: open

Using `NOT` in compound expressions leads to garbage results.

As an example, take the expression

foo AND NOT bar

for dummy configuration values `foo` and `bar` (or any other values which evaluate to false).

Assuming my understanding of the code is correct, after the first iteration of `LOOP`, the parser state should be

$truth = 0;
$prevtruth = 0;
$key = ' NOT';
$op = 'AND';

The very first statement of the next iteration will set `$op` to `'NOT'`, and the code paths for `$op eq 'AND' ` will never be reached.

Effectively, the expression will reduced to

NOT bar

Incidentally, the value of `$prevtruth` is never used, which strongly suggests that the implied algorithm was never implemented completely or incorrectly refactored.