[EXT_EP-10241] Loop that iterates a very large number of times causes compiler to fail with: Optimizer terminated abnormally Created: 03/Feb/21  Updated: 08/Jan/25

Status: In Development
Project: Embedded Software & Tools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Low
Reporter: TI User Assignee: TI User
Resolution: Unresolved Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Product: Code Generation Tools
Internal ID: CODEGEN-8576
Forum URL: https://e2e.ti.com/support/processors/f/791/t/976011
Found In Release: C7000_2.1.2.LTS
C7000_2.0.1.STS
C7000_2.1.0.LTS
ARM_18.12.0.LTS
C7000_5.0.0.LTS
C2000_21.6.0.LTS
C7000_3.0.0.STS
C7000_3.1.0.LTS
C7000_6.0.0.LTS*
ARM_20.2.0.LTS
C7000_4.0.0.STS
C7000_4.1.0.LTS
C2000_20.2.0.LTS
C7000_1.4.0.LTS
C2000_22.6.0.LTS
C7000_2.0.0.STS
C2000_18.12.0.LTS
Affected Platform/Device: default

 Description   

The attached source file has this function ...

static void writeData(uint8_t* pbyData, uint64_t sizeSize)
{
        for(uint64_t x = 0; x < sizeSize; x++) {
                pbyData[x] = (uint8_t)x;
        }
}

The function is invoked with the constant value 0x100000000 for the second argument sizeSize.  Under -o3, the compiler is able to determine that the loop iterates 0x100000000 times.  Something then goes wrong as the optimizer part of the compiler processes this very large iteration count.

% cl7x -o3 main.cpp

>>>> Optimizer terminated abnormally
>>>>    in function main()
>>>>    in file "main.cpp"

This is caused by a defect in the TI C/C++ Optimizer.
TI Customer Support may be able to suggest a workaround to avoid this.

Upgrading to the newest version of the compiler may fix this problem.

Contact TI in the E2E support forums at http://e2e.ti.com under
"Development Tools", "TI C/C++ Compiler".  See the link titled
"Submitting an issue".

We need to see this ENTIRE error message and a complete, reproducible
test case including ALL of the command-line options.
Include the .pp file created by option --preproc_with_comment

>> Compilation failure

Generated at Thu Apr 03 03:22:25 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.