Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 403
    • Issues 403
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #1322
Closed
Open
Created Sep 01, 2005 by Kai Trojahner@ktrGuest

Major issue in loop handling

Bugzilla Link 110
Created on Sep 01, 2005 08:24
Resolution FIXED
Resolved on Jun 16, 2008 13:08
Version 1.00beta
OS All
Architecture All
Attachments tutu2.sac, rotate.sac, test.sac

Extended Description

The attached example behaves differently depending on whether or not Loop Invariant Removal is 
activated or not. As I am yet not sure where this bug does actually stem from, I will shortly discuss what 
I found out.
The example looks like this:
use Array: all;
use SimplePrint: all;
int main() {
  A = with (.<=iv=[x,y]<=.) {
        i = 0;
        do { 
          i = i+1;
        } while ( i+x<10);
      }
      genarray( [10,10],i);
   c = print( A);
   return(c);  
}
When stopping the compilation after the optimizations (currently -b13) the relevant part of the code 
looks like this:
 i = 0; 
  A = with ( _flat_7_iv )
        ([ 0, 0 ] <= _flat_7_iv=[_flat_5_x, _flat_6_y] (IDXS:_wlidx_88_A) < [ 10, 10 ]) { 
          do 
          {
              i__SSA0_1 = (i + 1); 
              _pinl_90___flat_88 = (i__SSA0_1 + _flat_5_x); 
              _pinl_91___flat_45 = (_pinl_90___flat_88 < 10); 
              i = i__SSA0_1; 
          }
          while (_pinl_91___flat_45);
        } : i__SSA0_1 ; 
      genarray( [ 10, 10 ]) /* IDX: _wlidx_88_A */; 
As we can now clearly see, the errornous behaviour stems from i being overwritten in the with-loop 
body. However, the problem IS NOT caused by Loop Invariant Removal as i = 0 does certainly not 
depend on the index vector and is thus moved out of the with-loop correctly.
The issue becomes even more dramatic in this slightly modified example whose execution does not 
terminate at all:
int main() {
  i = 0;
  A = with (.<=iv=[x,y]<=.) {
        do { 
          i = i+1;
        } while ( i+x<10);
      }
      genarray( [10,10],i);
   c = print( A);
   return(c+i);  
}
My guess is that this bug is caused by lac2fun. What do you think?
Cheers,
Kai
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking