From d92cd344add84aa17434baefed24a6c548471cc2 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Tue, 18 Jun 2024 10:23:37 -0700 Subject: [PATCH] chore[docs]: add evaluation order warning for builtins (#4158) some builtins have undefined order of evaluation of arguments; make a note in the docs --- docs/built-in-functions.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/built-in-functions.rst b/docs/built-in-functions.rst index 367a08d80d..a0e424adb4 100644 --- a/docs/built-in-functions.rst +++ b/docs/built-in-functions.rst @@ -1090,3 +1090,6 @@ Utilities .. note:: Issuing of the static call is *NOT* mode-dependent (that is, it is not removed from production code), although the compiler will issue a warning whenever ``print`` is used. + +.. warning:: + In Vyper, as of v0.4.0, the order of argument evaluation of builtins is not defined. That means that the compiler may choose to reorder evaluation of arguments. For example, ``extract32(x(), y())`` may yield unexpected results if ``x()`` and ``y()`` both touch the same data. For this reason, it is best to avoid calling functions with side-effects inside of builtins. For more information, see `GHSA-g2xh-c426-v8mf `_ and `issue #4019 `_.