llvm / llvm/llvm-project

[Flang] Runtime error for RANDOM_NUMBER with HARVEST argument that is REAL(2)

Open
#193,185 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

flang:runtime
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Flang does not support the RANDOM_NUMBER intrinsic with half-precision (REAL(KIND=2)) arguments, resulting in a runtime error.

Expected Behavior: The RANDOM_NUMBER intrinsic should support REAL(KIND=2) (half-precision) arguments.

Actual Behavior: Flang compiles the code successfully but produces a runtime error:

fatal Fortran runtime error: not yet implemented: intrinsic: REAL(KIND=2) in RANDOM_NUMBER
Aborted (core dumped)

Reproducer:

Program test
  Real(2) x(2000)
  Call Random_number(x)
  Print *,x(1),x(2000)
End

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Fortran reproducer and trace the Flang implementation of the RANDOM_NUMBER intrinsic for REAL(KIND=2) arguments. Done means the program compiles and runs without the current “not yet implemented” runtime error, printing values for both array elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.