Changeset 5f210c0 for src/ControlStruct


Ignore:
Timestamp:
Aug 4, 2024, 9:49:25 PM (5 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
7db4fcd4
Parents:
7ab24fef
Message:

Change enum pos to signed int to avoid underflow; operator on enum will not have range check (but succ and pred still have range check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/TranslateEnumRange.cpp

    r7ab24fef r5f210c0  
    5151    // it wraps around and become unsigned max
    5252    ast::UntypedExpr * condition = ast::UntypedExpr::createCall( location,
    53         "?<=?",
     53        stmt->is_inc? "?<=?": "?>=?",
    5454        {   new ast::NameExpr( location, indexName ),
    55             ast::UntypedExpr::createCall( location, "upperBound", {} )  });
     55            stmt->is_inc?
     56                ast::UntypedExpr::createCall( location, "upperBound", {} ):
     57                ast::UntypedExpr::createCall( location, "lowerBound", {} )
     58        });
    5659    auto increment = ast::UntypedExpr::createCall( location,
    5760        stmt->is_inc? "succ_unsafe": "pred_unsafe",
Note: See TracChangeset for help on using the changeset viewer.