Skip to content

compute_precision() does not understand Literal precisions #3557

Closed

Description

@mn416

I noticed this issue while working on PR #3554.

subroutine sub()
  real(4) :: r
  r = r + 1.0_4
end subroutine

The value of psyir.walk(Assignment)[0].rhs.datatype is Scalar<REAL, UNDEFINED>. This is because the types of the arguments to + have slightly different representations:

  • Scalar<REAL, 4>
  • Scalar<REAL, Literal[value:'4', Scalar<INTEGER, UNDEFINED>]>

I think the source of the problem is that the compute_precision() function does not understand Literal precisions. It is probably an easy fix.

Activity

  1. mn416 commented on Aug 13, 2026

    @mn416
    CollaboratorAuthor

    Hmm, looks like an issue was created for this already: #3538. I'll move my comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions