chapel icon indicating copy to clipboard operation
chapel copied to clipboard

[Bug]: Internal compiler error OPT-INF-EFS-0652 when converting to C-pointer a function with arrays passed by reference

Open lucaferranti opened this issue 9 months ago • 2 comments

Summary of Problem

Description:

Running the code below produces the error message below. I cannot get the function to be non-generic. When I had the [1..3 real(64) inlied in the proc declaration I was getting an error message that the proc is generic and cannot be captured. Factoring that out to a type variable led to the internal compiler error below.

Is this a blocking issue with no known work-arounds?

Steps to Reproduce

Source Code:

use CTypes;

type D = [1..3] real(64);

proc normalize(ref ret: D, const ref input: D): void {
  for i in 1..3 {
    ret[i] = input[i];
  }
}

var f = c_ptrTo(normalize);

Error message:

internal error: OPT-INF-EFS-0652 chpl version 2.1.0 pre-release (44b3e6b437)

Internal errors indicate a bug in the Chapel compiler,
and we're sorry for the hassle.  We would appreciate your reporting this bug --
please see https://chapel-lang.org/bugs.html for instructions.

Compile command: chpl tmp.chpl

Associated Future Test(s):

Configuration Information

  • Output of chpl --version:
❯ chpl --version
chpl version 2.1.0 pre-release (44b3e6b437)
  built with LLVM version 14.0.0
  available LLVM targets: m68k, xcore, x86-64, x86, wasm64, wasm32, ve, systemz, sparcel, sparcv9, sparc, riscv64, riscv32, ppc64le, ppc64, ppc32le, ppc32, nvptx64, nvptx, msp430, mips64el, mips64, mipsel, mips, lanai, hexagon, bpfeb, bpfel, bpf, avr, thumbeb, thumb, armeb, arm, amdgcn, r600, aarch64_32, aarch64_be, aarch64, arm64_32, arm64
Copyright 2020-2024 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
  • 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: none
CHPL_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 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As a bonus question, I'd like to learn to debug those better myself. Any general pointer on what is a good workflow? How do I use read the error mesage code and extract meaningful information from it?

lucaferranti avatar May 20 '24 07:05 lucaferranti