public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4028] ada: Fix internal error on misaligned component with variable nominal size
@ 2023-09-15 13:04 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-09-15 13:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:140e20f69754bd04b7ee47518d065c1338780c36

commit r14-4028-g140e20f69754bd04b7ee47518d065c1338780c36
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Sep 7 10:53:39 2023 +0200

    ada: Fix internal error on misaligned component with variable nominal size
    
    The back-end cannot handle this kind of components even when they are small.
    
    gcc/ada/
    
            * exp_util.adb (Component_May_Be_Bit_Aligned): Do not return false
            for a small component of a record type with a variant part.

Diff:
---
 gcc/ada/exp_util.adb | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index b2542d4ae59..2e6a1cf892e 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -4989,12 +4989,15 @@ package body Exp_Util is
          return False;
 
       --  If we know that we have a small (at most the maximum integer size)
-      --  record or bit-packed array, then everything is fine, since the back
-      --  end can handle these cases correctly, except if a slice is involved.
+      --  bit-packed array or record without variant part, then everything is
+      --  fine, since the back end can handle these cases correctly, except if
+      --  a slice is involved.
 
       elsif Known_Esize (Comp)
         and then Esize (Comp) <= System_Max_Integer_Size
-        and then (Is_Record_Type (UT) or else Is_Bit_Packed_Array (UT))
+        and then (Is_Bit_Packed_Array (UT)
+                   or else (Is_Record_Type (UT)
+                             and then not Has_Variant_Part (UT)))
         and then not For_Slice
       then
          return False;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-15 13:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 13:04 [gcc r14-4028] ada: Fix internal error on misaligned component with variable nominal size Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).