]> gcc.gnu.org Git - gcc.git/commit
Fix uninitialized variable with nested variant record types
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 10 Sep 2020 15:47:32 +0000 (17:47 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 10 Sep 2020 16:02:12 +0000 (18:02 +0200)
commitd5bb0b0fa83eb7adc9fdae40272affc8a9cddf94
tree094e98f398ed6387dfcfc002ab1b0a7b94160b66
parent3222a3e9a9462cdca27020795071677f335be73a
Fix uninitialized variable with nested variant record types

This fixes a wrong code issue with nested variant record types: the
compiler generates move instructions that depend on an uninitialized
variable, which was initially a SAVE_EXPR not instantiated early enough.

gcc/ada/ChangeLog:
* gcc-interface/decl.c (build_subst_list): For a definition, make
sure to instantiate the SAVE_EXPRs generated by the elaboration of
the constraints in front of the elaboration of the type itself.

gcc/testsuite/ChangeLog:
* gnat.dg/discr59.adb: New test.
* gnat.dg/discr59_pkg1.ads: New helper.
* gnat.dg/discr59_pkg2.ads: Likewise.
gcc/ada/gcc-interface/decl.c
gcc/testsuite/gnat.dg/discr59.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr59_pkg1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr59_pkg2.ads [new file with mode: 0644]
This page took 0.077958 seconds and 5 git commands to generate.