https://gcc.gnu.org/g:52d71516634642bf99108fe7cfbfcbc46639518e

commit r16-5659-g52d71516634642bf99108fe7cfbfcbc46639518e
Author: Ghjuvan Lacambre <[email protected]>
Date:   Mon Nov 17 16:23:50 2025 +0100

    ada: sem_ch13.adb: accept VADS inline asm in Relaxed RM Semantics mode
    
    VADS inline assembly works by using a qualified expression for one of
    the types defined in the Machine_Code package, e.g.
    
       procedure P is
       begin
          code_2'(INSTR, OPERAND1, OPERAND2);
       end y;
    
    This is different from GNAT's own inline assembly machinery, which
    instead expects a call to Machine_Code.ASM with a set of
    differently-typed arguments.
    
    This incompatibility is preventing GNATSAS' GNAT-Warnings engine from
    analyzing VADS code, hence we adapt sem_ch13.adb to not fail on such
    constructs when GNAT is running under both Check_Semantics_Only_Mode and
    Relaxed_RM_Semantics mode.
    
    gcc/ada/ChangeLog:
    
            * sem_ch13.adb (Analyze_Code_Statement): Do not emit error
            message when only checking relaxed semantics.

Diff:
---
 gcc/ada/sem_ch13.adb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 98c3335e593c..b90c73018953 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -8482,7 +8482,15 @@ package body Sem_Ch13 is
       if Etype (Expression (N)) = Any_Type then
          return;
       elsif not Is_RTE (Etype (Expression (N)), RE_Asm_Insn) then
-         Error_Msg_N ("incorrect type for code statement", N);
+
+         --  Only emit an error message when not running in Relaxed RM
+         --  Semantics. This enables GNATSAS' GNAT Warnings engine to work on
+         --  VADS codebases.
+
+         if not (Check_Semantics_Only_Mode and then Relaxed_RM_Semantics) then
+            Error_Msg_N ("incorrect type for code statement", N);
+         end if;
+
          return;
       end if;

Reply via email to