[COMMITTED,4/9] ada: Assert failure in repinfo

Message ID 20240806090241.576862-4-poulhies@adacore.com
State Committed
Commit 59276c4d98a62e19622dc9ff9905f6d113497811
Headers
Series [COMMITTED,1/9] ada: Reject use-clause conflicts in the run-time library |

Commit Message

Marc Poulhiès Aug. 6, 2024, 9:02 a.m. UTC
  From: Javier Miranda <miranda@adacore.com>

Using switch gnatR4, the frontend crashes when generating information
for a private record type.

gcc/ada/

	* repinfo.adb (List_Record_Info): Handle private record types.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/repinfo.adb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index 7dada5358f7..c08a232a3ab 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -521,7 +521,11 @@  package body Repinfo is
 
                elsif Is_Record_Type (E) then
                   if List_Representation_Info >= 1 then
-                     List_Record_Info (E, Bytes_Big_Endian);
+                     if Is_Private_Type (E) then
+                        List_Record_Info (Full_View (E), Bytes_Big_Endian);
+                     else
+                        List_Record_Info (E, Bytes_Big_Endian);
+                     end if;
 
                      --  Recurse into entities local to a record type