WEDNESDAY, SEPTEMBER 23, 2026
c++
Fix type handling for array domain unification.
Corrects array domain unification to prevent incorrect rejection of testcases on lp64 targets.
The C++ frontend’s array domain unification logic has been fixed to correctly handle type conversions. Previously, it forcefully used integer types for additions, leading to incorrect rejection of valid code on lp64 targets. The change ensures additions are performed using the actual type of the operands, resolving the issue.
In Details
The unify_array_domain function in pt.cc was incorrectly coercing parm_max and arg_max to int before adding 1. This commit changes the logic to perform the addition in the type of the operands themselves (typically sizetype/size_t), thus fixing a bug where valid code was rejected on lp64 targets due to type mismatches.
For Context
- lp64
- A common system architecture data model where 'long' and pointers are 64 bits, and 'int' is 32 bits. This is typical for 64-bit Unix-like systems.
- array domain unification
- A compiler optimization or analysis technique that simplifies or standardizes representations of array types or access patterns within the compiler's intermediate representation.
- sizetype
- An integer type used by the compiler to represent sizes of objects in memory. It's typically equivalent to
size_tin C.