[Ada] Spurious warning on uninitialized entity during code generation
commit2157fb63fc455d5d93231df2635e98d993412b00
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Oct 2018 15:04:53 +0000 (9 15:04 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Oct 2018 15:04:53 +0000 (9 15:04 +0000)
tree7f1033869d9a3a083734be3e352ad606478c95ba
parent6cfbd82f290f606f92d6b2cd4ac185e3fc6fdc24
[Ada] Spurious warning on uninitialized entity during code generation

This patch suppresses a spurious warning coming from the GCC backend, on
an aggregate that cannot be built in place and for which a temporary
variable must be created. If the type of the aggregate is a packed
boolean array, the generated code may appear to use an uninitialized
value for a component of the array, when in fact the code simply sets a
single bit of that array.

2018-10-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_aggr.adb (Expand_Array_Aggregate): If it is not possible
to build in place an aggregate with component associations, set
the Warnings_Off flag on the generated temporary, to prevent
spurious warnings from the backend when compiling with the
-Wuninitialized gcc flag.

gcc/testsuite/

* gnat.dg/warn18.adb: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264960 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/warn18.adb [new file with mode: 0644]