Skip to content

Precision literals should be stored as Literal, not int #3538

Open

Description

@sergisiso

This will add methods to work as if it where any other expression , e.g. copy(), without having to have edge cases.

Activity

  1. added a commit that references this issue on Aug 7, 2026
  2. mn416 commented on Aug 13, 2026

    @mn416
    Collaborator

    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.

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