AdaCore: Build Software that Matters
I Stock 2162001104
Mar 10, 2026

GNAT IQ

AdaCore is delighted to announce unlimited access to GNAT IQ for all of our current customers. GNAT IQ is AdaCore’s AI-powered GNAT documentation chatbot. GNAT IQ is in beta right now, but we’re confident you’ll find GNAT IQ helpful, and we are excited for you to get started.

At AdaCore, our mission is to help you build software that matters. We’re approaching the inclusion of AI capabilities in our products in a principled, thoughtful, and, above all, optional way. GNAT IQ represents the first AI-powered capability we’re offering.

What is GNAT IQ?

GNAT IQ fills the gap between reading or searching our extensive documentation and asking an expert for help. Built using retrieval-augmented generation, GNAT IQ fuses documentation search with Large-Language Model (LLM)-powered generative AI to return answers that include citations to our documentation - so you can follow up and gain deeper insights, as needed.

In our experience, GNAT IQ finds answers to questions much more quickly than searching our documentation directly. This is especially true if we don’t know ahead of time which document to search! GNAT IQ searches all of our documentation at once and returns an answer focused on the question's context.

Using GNAT IQ, you can get help with questions like:

  • Can you point me to the manual page that talks about proof levels in SPARK?
  • What are my options for building a library in Ada? Can you give me some examples of project files?
  • Can you help me understand how to use the gnatcoll library?


Here are a few of examples of conversations you might have with GNAT IQ.

32-bit v 64-bit Compilers

User Message

We've been updating our code base to use Ada 2012 aspects instead of pragmas and ran into an issue with Link_Name. For example, the following:

function Size (Buffer : Access_Buffer) return Interfaces.C.int
  with Import, Convention => C, Link_Name => "size" ;

compiles fine with the 64-bit compiler, but not the 32-bit compiler. Why?

GNAT IQ Response

This issue is related to how different calling conventions handle name mangling, particularly between 32-bit and 64-bit Windows platforms.

When you specify Link_Name, you're providing the exact name to be used by the linker with no decoration at all - no leading underscore and no Stdcall suffix @nn [1]. However, with the C calling convention, when the Link_Name parameter is missing, this parameter is set to the External_Name with a leading underscore [2].

The difference you're seeing is likely because:

  1. On 64-bit Windows: The Stdcall calling convention is handled as a C calling convention on non-Windows platforms [1], and the C convention typically doesn't add name decorations on 64-bit systems.
  2. On 32-bit Windows: The compiler expects different name mangling rules. In the C calling convention, the name of a routine with C calling convention is mangled by adding a leading underscore [2].

To fix this, you have two options:

Option 1: Use External_Name instead of Link_Name:

function Size (Buffer : Access_Buffer) return Interfaces.C.int
  with Import, Convention => C, External_Name => "size";

Option 2: Ensure your Link_Name matches the actual mangled name expected by the 32-bit linker (which might include a leading underscore):

function Size (Buffer : Access_Buffer) return Interfaces.C.int
  with Import, Convention => C, Link_Name => "_size";

External_Name provides the "starting point" for name modification by the compilation system, while Link_Name specifies the exact name with no modifications [3]. For cross-platform compatibility, External_Name is usually the better choice as it allows the compiler to apply the appropriate platform-specific naming conventions.

Sqrt Tolerance

User Message

What's the maximum error we can expect for the sqrt function in Ada?

GNAT IQ Response

The maximum relative error for the Sqrt function in Ada is 2.0 · EF.Float_Type'Model_Epsilon [1], where EF refers to the instantiated elementary functions package and Float_Type is the specific floating-point type being used.

This error bound is part of Ada's accuracy requirements for elementary functions and applies to the square root function specifically. The maximum relative error exhibited by each function is as follows: 2.0 · EF.Float_Type'Model_Epsilon, in the case of the Sqrt, Sin, and Cos functions [1].

The Model_Epsilon attribute represents the model epsilon for the floating-point type, which is the absolute value of the difference between 1.0 and the smallest model number greater than 1.0 for that type. This means the actual error you'll see depends on the precision of the specific floating-point type you're using (Float, Long_Float, etc.).

Question/Response in French

User Message

Comment mettre en place GNAT SAS dans Gitlab CI ?

GNAT IQ Response

Pour mettre en place GNAT SAS dans GitLab CI, voici les étapes principales :

Prérequis

Pour permettre l'exécution de GNAT SAS dans un CI, une exigence est de le rendre disponible au pipeline GitLab. Pour ce faire, une approche simple consiste à l'intégrer dans une image Docker. [1] Ceci n'est pas détaillé ici et la section suivante suppose qu'une telle image a été créée et publiée dans votre registre de conteneurs GitLab, et qu'elle est disponible sous REGISTRY_URL/PROJECT_PATH/gnatsas:24.0w. [1]

Configuration du pipeline

Créez un fichier .gitlab-ci.yml à la racine de votre projet avec la configuration suivante :

default:
   image: $REGISTRY_URL/$PROJECT_PATH/gnatsas:24.0w

GNATSAS:
   script:
      - gnatsas analyze -P my_project.gpr
      - gnatsas report -P my_project.gpr
      - gnatsas
            report
            code-climate
            -P my_project.gpr
            --out $CI_PROJECT_DIR/gnatsas/code_quality_report.json
            --root $CI_PROJECT_DIR
            --long-desc

   artifacts:
      - paths: gnatsas/
   reports:
      codequality: gnatsas/code_quality_report.json

Détail des étapes

  1. Analyse : Pour exécuter l'analyse, lancez simplement la commande gnatsas analyze sur le fichier GPR du projet [2]
  2. Rapport texte : Pour afficher les résultats de l'analyse au format texte dans le log CI, exécutez la commande suivante: gnatsas report -P my_project.gpr [3]
  3. Rapport CodeClimate : GNAT SAS fournit le format de rapport d'export CodeClimate qui permet d'afficher les résultats dans l'interface utilisateur GitLab. Il faut déclarer le chemin du rapport (ici, code_quality_report.json) pour que GitLab le prenne en compte [3]

Notez le switch --long-desc spécifié au format de rapport CodeClimate. Ce switch génère des messages avec une description qui contient plus d'informations qu'habituellement, telles que le nom de la vérification, le moteur d'analyse, CWE... car ces informations ne sont pas affichées par défaut dans le widget CodeQuality intégré dans GitLab. [3]

Cette configuration permettra d'avoir les résultats GNAT SAS directement visibles dans l'onglet "Code Quality" de l'interface GitLab.

Question/Response in Dutch

User Message

Hoe schrijf ik een postconditie die aangeeft dat het resultaat van een functie het kwadraat van de input is?

GNAT IQ Response

Je kunt een postcondition schrijven die aangeeft dat het resultaat van een functie het kwadraat van de input is door gebruik te maken van het 'Result attribuut binnen een postcondition expressie [1]. Hier is een voorbeeld:

function Square (X : Integer) return Integer is (X * X) with
  Post => Square'Result = X * X;

Voor een meer uitgebreide functiedeclaratie:

function Square (X : Integer) return Integer with
  Post => Square'Result = X * X
is
begin
   return X * X;
end Square;

Het 'Result attribuut verwijst naar de return waarde van de functie voor welke de postcondition wordt geëvalueerd [2]. In dit geval controleert de postcondition dat het geretourneerde resultaat gelijk is aan X * X.

Je zou ook een meer complexe postcondition kunnen schrijven die rekening houdt met verschillende gevallen, zoals in dit voorbeeld met een conditionele expressie: (if abs A in 0 | 1 then Square'Result = abs A else Square'Result > A) [2].

Voor expression functions zoals function Square (X : Integer) return Integer is (X * X) genereert GNATprove automatisch de meest precieze postcondition [3], dus het toevoegen van een expliciete postcondition is vaak niet nodig tenzij je specifieke constraints wilt afdwingen.

What isn’t GNAT IQ?

We think GNAT IQ is great, but we note that it’s not meant to do everything.

Most importantly, GNAT IQ is not mandatory nor meant to replace the expert customer support you’ve come to expect and rely on from AdaCore. If you’re stuck or you’ve encountered a bug, please open a case and let us know. We’ll work quickly to unblock you. Your cases are important to us. They help us understand where people are encountering challenges using our products, which we then use to help build our roadmap. We still want to hear from you!

GNAT IQ isn’t designed to be a general-purpose coding assistant. While the underlying model we use for answer generation is good at coding-related tasks, there’s a risk that, should you ask GNAT IQ to generate code, the model will respond based on its training alone, rather than with reference to our documentation. You can help GNAT IQ offer solutions that are better grounded in our documentation by first making an explicit reference to our tools before stating the problem you’re trying to solve.

Finally, like all AI systems, GNAT IQ isn’t perfect. It can and will make mistakes. But we’ve found that GNAT IQ is correct and helpful far more often than not.

Conclusion

We are continuing to iterate on GNAT IQ with the aim of making it more helpful and more precise - especially if you’re using an older version of our products.

Current customers can access GNAT IQ directly within GNAT Tracker and start using it today. If you have any questions, reach out to your account manager or open a ticket in GNATtracker. If you are not yet a customer but would like to learn more about GNAT IQ, please contact us at sales@adacore.com.

GNAT IQ is just the start of our use of AI in AdaCore products. We’ll be back soon to tell you about more ways we’re thoughtfully bringing AI capabilities to our tools, so you can build software that matters more effectively and efficiently.

Author

M. Anthony Aiello

Screenshot 2025 03 20 at 16 11 27

Tony Aiello is a Product Manager at AdaCore. Currently, he manages SPARK Pro and the GNAT Static Analysis Suite.

Blog_

Latest Blog Posts