From f4437882fe972b14eb5f4163de34fa9c909b5fb6 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Thu, 19 Sep 2019 08:12:34 +0000 Subject: [PATCH] [Ada] Rtsfind: improve comment on RTE_Available 2019-09-19 Bob Duff gcc/ada/ * rtsfind.ads (RTE_Available): Improve comment. From-SVN: r275930 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/rtsfind.ads | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c42498ef176..7b4bb470888 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2019-09-19 Bob Duff + + * rtsfind.ads (RTE_Available): Improve comment. + 2019-09-18 Bob Duff * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Move call diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads index 9d5a86cdb72..2467f85666b 100644 --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -3203,6 +3203,23 @@ package Rtsfind is -- Returns true if a call to RTE will succeed without raising an exception -- and without generating an error message, i.e. if the call will obtain -- the desired entity without any problems. + -- + -- If we call this and it returns True, we should generate a call to E. + -- In other words, the compiler should not call RTE_Available (E) until + -- it has decided it wants to generate a call to E. Otherwise we can get + -- spurious dependencies and elaboration orders. + -- + -- if RTE_Available (E) -- WRONG! + -- and then + -- then + -- generate call to E; + -- + -- Should be: + -- + -- if + -- and then RTE_Available (E) -- Correct + -- then + -- generate call to E; function RTE_Record_Component (E : RE_Id) return Entity_Id; -- Given the entity defined in the above tables, as identified by the