From: Yannick Moy Date: Mon, 21 May 2018 14:50:49 +0000 (+0000) Subject: [Ada] Crash on incorrect frontend inlining in GNATprove mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fe44c442e4c83f3280a72e917c418c6e6129cba7;p=gcc.git [Ada] Crash on incorrect frontend inlining in GNATprove mode In some cases, the inlining performed in GNATprove mode leads to a crash, when inlining a call where a return statement of the inlined function returns a string literal. Now fixed. 2018-05-21 Yannick Moy gcc/ada/ * sem_eval.adb (Static_Length): Take into account case of variable of subtype string literal. From-SVN: r260452 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index faa11548ead..d8e644ee2db 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-04-04 Yannick Moy + + * sem_eval.adb (Static_Length): Take into account case of variable of + subtype string literal. + 2018-04-04 Olivier Hainque * libgnat/s-objrea.ads (Get_Memory_Bounds): Rename as Get_Xcode_Bounds. diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 93536cbacda..ca516262c36 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -3403,6 +3403,13 @@ package body Sem_Eval is if Nkind (Expr) = N_String_Literal then return UI_From_Int (String_Length (Strval (Expr))); + -- With frontend inlining as performed in GNATprove mode, a variable + -- may be inserted that has a string literal subtype. Deal with this + -- specially as for the previous case. + + elsif Ekind (Etype (Expr)) = E_String_Literal_Subtype then + return String_Literal_Length (Etype (Expr)); + -- Second easy case, not constrained subtype, so no length elsif not Is_Constrained (Etype (Expr)) then