Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Ignoring the return value of a type function results in a compiler segfault #25039

Open
jabraham17 opened this issue May 14, 2024 · 0 comments

Comments

@jabraham17
Copy link
Member

jabraham17 commented May 14, 2024

Summary of Problem

Description:
Ignoring the return value of a type function with a user defined generic type causes a compiler segfault. Making the type concrete or capturing the return value (type x = ...) restores correct behavior.

Is this a blocking issue with no known work-arounds?
The workaround is to just use a unused return value like type x = ...

Steps to Reproduce

Source Code:

record R1 { }
record R2 { type t; }
record R3 { type t = int; }

proc bar(type t) type {
  compilerWarning(t:string);
  return t;
}

bar(int);

bar(R1);

bar(R2); // segfaults at compile-time
bar(R2(?)); // segfaults at compile-time
bar(R2(int)); 
bar(R3); // segfaults at compile-time
bar(R3(?)); // segfaults at compile-time
bar(R3(real));

type x = bar(R2); // this is fine

Compile command:
chpl foo.chpl

Associated Future Test:
test/functions/generic/type-func-return-generic.chpl

Configuration Information

  • Output of chpl --version: chpl version 2.1.0 pre-release (6eb9035)
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: arm64
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: system *
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: Homebrew clang version 17.0.6
jabraham17 added a commit that referenced this issue May 14, 2024
Files a future for bug filed in #25039

[Not reviewed - trivial]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant