public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2066] [Ada] Crash on use of 'Img on record type in expression
@ 2021-07-06 14:49 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-06 14:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3a7961c89914cf544018e731693418f18b5cc984

commit r12-2066-g3a7961c89914cf544018e731693418f18b5cc984
Author: Ed Schonberg <schonberg@adacore.com>
Date:   Mon May 10 09:40:22 2021 -0400

    [Ada] Crash on use of 'Img on record type in expression
    
    gcc/ada/
    
            * exp_ch4.adb (Process_Transient_In_Expression): Ensure that
            Fin_Context, used to insert finalization code for the
            expression, is a list member: the value returned by
            Find_Hook_Context may be an expression node when the transient
            is part of a larger expression and it has a non-boolean type.

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

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 21b2c2225eb..738d651c693 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -14952,7 +14952,17 @@ package body Exp_Ch4 is
       --       Hook := null;
       --    end if;
 
+      --  Note that the value returned by Find_Hook_Context may be an
+      --  operator node, which is not a list member. We must locate in the
+      --  tree the proper node after which to inwert the finaliation code.
+
       else
+         while not Is_List_Member (Fin_Context) loop
+            Fin_Context := Parent (Fin_Context);
+         end loop;
+
+         pragma Assert (Present (Fin_Context));
+
          Insert_Action_After (Fin_Context,
            Make_Implicit_If_Statement (Obj_Decl,
              Condition =>


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

only message in thread, other threads:[~2021-07-06 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 14:49 [gcc r12-2066] [Ada] Crash on use of 'Img on record type in expression Pierre-Marie de Rodat

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).