External Issue: [Bug]:

28368, "shivkumarChandrasekaran", "[Bug]:", "2026-02-04T02:36:18Z"

Summary of Problem

Description:

When I switched two nested forall loops over simple ranges to a single forall loop over an array of tuples, an internal reduce statement is triggering the bug: internal error: AST-PRI-IVE-00383 chpl version 2.7.0

Is this issue currently blocking your progress? yes

Steps to Reproduce

Source Code:

param Ncl = 10;
param Ntrn = 5000;
param H = 32;
param W = 32;
param Nch = 3;
param tileSize = 24;

const tilepos = [(0,0), (0,8), (4,4), (8,0), (8,8)];
const trnimgs : [0..#Ncl, 0..#Ntrn, 0..#H, 0..#W, 0..#Nch] int (32);
forall scls in 0..#Ncl {
    forall n in 0..#Ntrn {
        var mindists : [0..(H - tileSize), 0..(W - tileSize)] int (64) = 0;
        forall (si, sj) in tilepos {
        const ref ssn = trnimgs[scls, n, si..#tileSize, sj..#tileSize, ..];
        var mndist : int (64) = 256;
        for tcls in 0..#Ncl {
            if tcls != scls {
            for m in 0..#Ntrn {
                for (ti, tj) in tilepos {
                const ref tsn = trnimgs[tcls, m, ti..#tileSize, tj..#tileSize, ..];
                const dnm = (+ reduce abs (ssn - tsn)) / (tileSize * tileSize * Nch);
                if dnm < mndist {
                    mndist = dnm;
                }
                }
            }
            }
        }
        mindists[si, sj] = mndist;
        }
    }
}

Compile command: chpl foo.chpl -o foo

Execution command: Not needed.

Associated Future Test(s): I don't think so.

Configuration Information

  • Output of chpl --version: chpl version 2.7.0
    built with LLVM version 20.1.8
    available LLVM targets: xcore, x86-64, x86, wasm64, wasm32, ve, systemz, spirv, spirv64, spirv32, sparcel, sparcv9, sparc, riscv64, riscv32, ppc64le, ppc64, ppc32le, ppc32, nvptx64, nvptx, msp430, mips64el, mips64, mipsel, mips, loongarch64, loongarch32, lanai, hexagon, bpfeb, bpfel, bpf, avr, thumbeb, thumb, armeb, arm, amdgcn, r600, aarch64_32, aarch64_be, aarch64, arm64_32, arm64

  • Output of $CHPL_HOME/util/printchplenv --anonymize: CHPL_TARGET_PLATFORM: linux64
    CHPL_TARGET_COMPILER: llvm
    CHPL_TARGET_ARCH: x86_64
    CHPL_TARGET_CPU: native
    CHPL_LOCALE_MODEL: flat
    CHPL_COMM: none
    CHPL_TASKS: qthreads
    CHPL_LAUNCHER: none
    CHPL_TIMERS: generic
    CHPL_UNWIND: system
    CHPL_TARGET_MEM: jemalloc
    CHPL_ATOMICS: cstdlib
    CHPL_GMP: bundled
    CHPL_HWLOC: bundled
    CHPL_RE2: bundled
    CHPL_LLVM: system
    CHPL_AUX_FILESYS: none

  • Back-end compiler and version, e.g. gcc --version or clang --version: gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)
    clang version 21.1.8 (Fedora 21.1.8-4.fc43)
    Target: x86_64-redhat-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg

  • (For Cray systems only) Output of module list: