From patchwork Sat Dec 8 12:10:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ada] Add obvious assertion Date: Sat, 08 Dec 2012 02:10:28 -0000 From: Eric Botcazou X-Patchwork-Id: 204647 Message-Id: <1548637.JpWYbVEsji@polaris> To: gcc-patches@gcc.gnu.org This adds an obvious assertion in the N_Indexed_Component case of gnat_to_gnu so as to avoid the associated crash a few lines below. Tested on x86_64-suse-linux, applied on the mainline. 2012-12-08 Eric Botcazou * gcc-interface/trans.c (gnat_to_gnu) : Assert that the type of the prefix is ultimately an array. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 194321) +++ gcc-interface/trans.c (working copy) @@ -5410,6 +5410,10 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = gnu_array_object; + /* The failure of this assertion will very likely come from a missing + expansion for a packed array access. */ + gcc_assert (TREE_CODE (TREE_TYPE (gnu_array_object)) == ARRAY_TYPE); + /* First compute the number of dimensions of the array, then fill the expression array, the order depending on whether this is a Convention_Fortran array or not. */