From 314265ec980ed9498b421279b2a26f9062fb07b8 Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Tue, 6 Oct 2026 23:00:32 +0200 Subject: [PATCH] Fix size mismatch and tag typo in register type merging Similar_Type decides two registers can share one generated Ada type by comparing field count, Dim, and field equality, but never compared Reg_Properties.Size. Equal, right above it, already does. Registers whose names share a stem after Common_Prefix strips trailing digits (e.g. FLUSH64/FLUSH32) could merge into one type despite different sizes, producing a register typed narrower or wider than its real width. Add the missing size check, matching Equal and placed next to the existing Dim check. Also fix "modifiedWriteValue" to "modifiedWriteValues", matching the actual CMSIS-SVD tag and descriptors-field.adb's spelling. The typo silently dropped every register-level element into the catch-all branch instead of recording it. Co-Authored-By: Claude Sonnet 5 --- src/descriptors-register.adb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/descriptors-register.adb b/src/descriptors-register.adb index 9bbfb71..574911b 100644 --- a/src/descriptors-register.adb +++ b/src/descriptors-register.adb @@ -137,7 +137,7 @@ package body Descriptors.Register is elsif Is_Register_Property (Tag) then Read_Register_Property (Child, Result.Reg_Properties); - elsif Tag = "modifiedWriteValue" then + elsif Tag = "modifiedWriteValues" then Result.Mod_Write_Values := Get_Value (Child); elsif Tag = "readAction" then @@ -228,6 +228,10 @@ package body Descriptors.Register is return Unbounded.Null_Unbounded_String; end if; + if R1.Reg_Properties.Size /= R2.Reg_Properties.Size then + return Unbounded.Null_Unbounded_String; + end if; + if R1.Dim /= R2.Dim then return Unbounded.Null_Unbounded_String; end if;