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 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2284
Closed
Open
Created Jan 24, 2022 by Sven-Bodo Scholz@sbsOwner

bug in CTZ

CTZ is not correct for unsigned types such as uint!

Example:

noinline
int foo( uint a)
{
   b = _lt_SxS_ ( 0ui, a);

   return _toi_S_( b);
}


int main ()
{
    return foo( 2ui );
}

CTZ turns the body into (sac2c -bopt):

int _MAIN::foo( uint a { ,NN } )
/*
 *  foo ::  ---
 */
{
  uint _esd_13 { , NN } ;
  int _flat_1 { , NN } ;
  bool b { , NN } ;

  _esd_13 = _neg_S_( a);
  b = _lt_SxS_( _esd_13, 0ui);
  _flat_1 = _toi_S_( b);
  return( _flat_1);
}

which clearly is not legal as neg_S is illegal. The fact that the type inference does not complain about it shows that the type inference is not correct for neg on unsigned types either :-) So it is two bugs for the price of one.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking