Fix another bug in selection subexpression handling.
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 10 Apr 2013 18:21:59 +0000 (21:21 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Wed, 10 Apr 2013 18:21:59 +0000 (21:21 +0300)
In this case, it did not work correctly if a variable with a dynamic
value was used both
1. in a boolean expression such that its evaluation group was not known
   in advance, and
2. in a context where it was always evaluated for all atoms (either as
   a selection, or as a parameter to a selection method),
and additionally the latter context appeared later in the selection set.
The initialization of the SEL_CDATA_STATICEVAL flag has a dependency on
SEL_CDATA_FULLEVAL flag, and they were not initialized in the correct
sequence in the above case.

Fixes #1219.

Backported from master with the same Change-Id.

Change-Id: Ic95d37a424c82c796806b3a5b39678e206c467a1

src/gmxlib/selection/compiler.c

index 973d75b21d0209ca7f178279c66c45d6693ae9f5..a10bd7a4911b81f86c4831cacd1ad197c42df264 100644 (file)
@@ -2774,6 +2774,13 @@ gmx_ana_selcollection_compile(gmx_ana_selcollection_t *sc)
         }
         /* Initialize the compiler data */
         init_item_compilerdata(item);
+        item = item->next;
+    }
+    /* Initialize the static evaluation compiler flags.
+     * Requires the FULLEVAL compiler flag for the whole tree. */
+    item = sc->root;
+    while (item)
+    {
         init_item_staticeval(item);
         item = item->next;
     }