From 0d8b6803b9abafea59b08702a582605316544245 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Mon, 21 May 2018 14:51:55 +0000 Subject: [PATCH] [Ada] Avoid compiler crash for body in non Ada 2012 mode 2018-05-21 Javier Miranda gcc/ada/ * sem_ch4.adb (Analyze_Membership_Op): Avoid compiler crash when the spec of a unit has Ada 2012 membership tests with multiple choices and the unit body is not compiled under Ada 2012 mode. From-SVN: r260464 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/sem_ch4.adb | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1d41d1e2fca..d21a5d95b23 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-04-04 Javier Miranda + + * sem_ch4.adb (Analyze_Membership_Op): Avoid compiler crash when the + spec of a unit has Ada 2012 membership tests with multiple choices and + the unit body is not compiled under Ada 2012 mode. + 2018-04-04 Doug Rupp * sigtramp-vxworks-target.inc: Set cfa_reg properly from sigcontext diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index e1e826e54ce..2452cf9cd47 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -3030,9 +3030,15 @@ package body Sem_Ch4 is begin Analyze_Expression (L); - if No (R) and then Ada_Version >= Ada_2012 then - Analyze_Set_Membership; - Check_Function_Writable_Actuals (N); + if No (R) then + if Ada_Version >= Ada_2012 then + Analyze_Set_Membership; + Check_Function_Writable_Actuals (N); + else + Error_Msg_N + ("multiple choices in membership tests only allowed in Ada 2012", + N); + end if; return; end if; -- 2.30.2