lua-users home
lua-l archive

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


> In my process of trying to compile Lua on various compilers,  I found
> that warning on IAR Embedded Workbench for ARM:
> 
> Warning[Pa082]: undefined behavior: the order of volatile accesses is
> undefined in this statement   ltable.c 82
> 
> Knowing that the order of evaluation is undefined scares me a little
> bit, although it might me pointless.

Note that is not order of evaluation, but order of access (only because
of the volatile).

Probably it refers to the second line in this segment:

  { volatile union luai_Cast u; u.l_d = (n) + 1.0;  /* avoid -0 */ \
    (i) = u.l_p[0] + u.l_p[1]; }  /* add double bits for his hash */

We could rewrite the sum as this, but I am not sure it is worth
the trouble:

    (i) = u.l_p[0]; (i) += u.l_p[1]; }

-- Roberto