[Ada] Do not perform null exclusion static checks on generated entities

Message ID 20200716092051.GA146434@adacore.com
State New
Headers show
Series
  • [Ada] Do not perform null exclusion static checks on generated entities
Related show

Commit Message

Pierre-Marie de Rodat July 16, 2020, 9:20 a.m.
Performing null exclusion checks on generated entities can result in
bogus error messages.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_ch3.adb (Analyze_Object_Declaration): Add
	Comes_From_Source call.

Patch

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -4055,7 +4055,7 @@  package body Sem_Ch3 is
             then
                null;
 
-            else
+            elsif Comes_From_Source (Id) then
                declare
                   Save_Typ : constant Entity_Id := Etype (Id);
                begin