GNU Info

Info Node: (g77-300.info)Transforming DO WHILE

(g77-300.info)Transforming DO WHILE


Next: Transforming Iterative DO Prev: Statements Needing Temporaries Up: Transforming Statements
Enter node , (file) or (file)node

Transforming DO WHILE
---------------------

   `DO WHILE(expr)' _must_ be implemented so that temporaries needed to
evaluate `expr' are generated just for the test, each time.

   Consider how `DO WHILE (A//B .NE. 'END'); ...; END DO' is
transformed:

     for (;;)
       {
         int temp0;
     
         {
           char temp1[large];
     
           libg77_catenate (temp1, a, b);
           temp0 = libg77_ne (temp1, 'END');
         }
     
         if (! temp0)
           break;
     
         ...
       }

   In this case, it seems like a time/space tradeoff between allocating
and deallocating `temp1' for each iteration and allocating it just once
for the entire loop.

   However, if `temp1' is allocated just once for the entire loop, it
could be the wrong size for subsequent iterations of that loop in cases
like `DO WHILE (A(I:J)//B .NE. 'END')', because the body of the loop
might modify `I' or `J'.

   So, the above implementation is used, though a more optimal one can
be used in specific circumstances.


automatically generated by info2www version 1.2.2.9