AdaCore / AdaCore/libadalang

p_standard_unit seems wrong with 22.0 compilers

Open
#663 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Ada
Stars
171
Forks
48
PR merge metrics
No merged PRs in 30d

Description

As part of a code generator, I am manipulating fixed point types. With more recent compiler wavefronts (supporting 128 bit integers), we have the following definition in system.ads:

 Max_Mantissa          : constant := Standard'Max_Integer_Size - 1;
  Fine_Delta            : constant := 2.0 ** (-Max_Mantissa);

where it used to be

Max_Mantissa          : constant := 63;
Fine_Delta            : constant := 2.0 ** (-Max_Mantissa);

My code generator is chocking at the moment because it doesn't know about the max_integer_size attribute. So I am trying to use p_standard_unit (from any node), which doesn't seem to include that definition either.

(presumably related: call p_eval_as_int on the expression for Fine_Delta raises an exception).

I also noticed that p_standard_unit doesn't include the new Long_Long_Long_Integer (which I do not need at this stage, but that shows it isn't up-to-date with the compiler).

Thanks
Manu

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 locating the implementation of p_standard_unit and compare its definitions with system.ads, especially Max_Integer_Size and Long_Long_Long_Integer. Reproduce the p_eval_as_int failure on Fine_Delta, then verify that p_standard_unit and expression evaluation handle the compiler definitions described in the issue.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.