[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC_JIT_BINARY_OP_LOGICAL_AND eager or lazy? and GCCJIT vs GNU C semantics....



On 07/16/2015 12:33, Basile Starynkevitch wrote:

GCC_JIT_BINARY_OP_LOGICAL_AND a lazy operation like in C, or is it eager? It is documented as

   Logical AND; analogous to:

   (EXPR_A)  &&  (EXPR_B)

   in C.

So I guess that it is lazy. In other words, if EXPR_A is non-null, EXPR_B is not even evaluated....

It looks to be translated with

    case GCC_JIT_BINARY_OP_LOGICAL_AND:
      node_a = as_truth_value (node_a, loc);
      node_b = as_truth_value (node_b, loc);
      inner_op = TRUTH_ANDIF_EXPR;
      break;

in file jit/jit-playback.c near line 2941 in function playback::context::new_binary_op

so given the name TRUTH_ANDIF_EXPR I guess that the operation GCC_JIT_BINARY_OP_LOGICAL_AND is indeed lazy.

Cheers.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***