[COMMITTED] ada: Accept aggregates with OTHERS clause in unchecked type conversions

Message ID 20230515094335.1408296-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Accept aggregates with OTHERS clause in unchecked type conversions |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès May 15, 2023, 9:43 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

When inlining subprogram calls in GNATprove mode, the actual parameter
is wrapped in an unchecked conversion. If this actual parameter is an
aggregate OTHERS clause, then the type of unchecked conversion allows us
to resolve this clause (just like for aggregates wrapped in a qualified
expression).

Previously such aggregates were rejected, which caused spurious and
cryptic errors; now they are accepted.

gcc/ada/

	* sem_aggr.adb (Resolve_Aggregate): Accept aggregates with OTHERS
	appearing inside unchecked conversions.

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

---
 gcc/ada/sem_aggr.adb | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 3ebb30d64ed..2ccfe6dcaef 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1180,6 +1180,7 @@  package body Sem_Aggr is
                                  | N_Component_Declaration
                                  | N_Parameter_Specification
                                  | N_Qualified_Expression
+                                 | N_Unchecked_Type_Conversion
                                  | N_Reference
                                  | N_Aggregate
                                  | N_Extension_Aggregate