5 Replies Latest reply on Aug 7, 2009 5:42 AM by gaurav.garg

    Parse Bugt inCAL-compiler ??

    geigerh
      calclCompile crashes on nested do / for / if construct

      When I extend (working) code using a do/while and a fo loop by an if /then /else clause, the compiler crashes

      do
          {           
              x++;       
              for(z=0; z<3; z++)
              {
                  if(z == 0)

                  {
                      syntype = (int)layer_resource_synt[x].x;
                      pre_index = (int)layer_resource_ind[x].x;
                      c = layer_resource_str[x].x;
                      intern_zv2_adapt = zv2_adapt.x;
                      intern_zv2_mp = zv2_mp.x;
                      intern_zv2_act = zv2_ac.x;

                  }
                  else if(z== 1)
                  {

                       ..some more code
                  }
                  else if(z == 2)
                  {
                        ..some more code
                  }
                  else if(z == 3)
                  {
                       ..some more code
                  }
       // THIS CRASHES THE COMPILER          
                  if(pre_index > -1)
                  {
                     isFinished = 1;
                  }

      // WORKS WELL WITHOUT IT (except it's an endless loop of course...

             } // end for

      }while (isFinished != 1);

      RESULT: access violation in the amdcalrt.dll

      Now I am willing to do without switch/case, I can even accept crashes if I insert a "break"-statement in the do/while-loop, and the missing goto, which would be very useful here, is also not a real problem, but if-statements are rather hard to replace.

      I have a temporary workaround where I call kernel functions for the do- and the for-loop, separating the if-clauses and this works but that's not really nice, is it?

      Anybody have any ideas?