{"id":810496,"url":"http://patchwork.ozlabs.org/api/patches/810496/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170906102956.GA127480@adacore.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170906102956.GA127480@adacore.com>","list_archive_url":null,"date":"2017-09-06T10:29:56","name":"[Ada] Derived iterable types with noniterable parent","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"89ee768d151e4bfd8e6d74bec2befd0ebeb5f1df","submitter":{"id":4418,"url":"http://patchwork.ozlabs.org/api/people/4418/?format=json","name":"Arnaud Charlet","email":"charlet@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170906102956.GA127480@adacore.com/mbox/","series":[{"id":1757,"url":"http://patchwork.ozlabs.org/api/series/1757/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1757","date":"2017-09-06T10:29:56","name":"[Ada] Derived iterable types with noniterable parent","version":1,"mbox":"http://patchwork.ozlabs.org/series/1757/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810496/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810496/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461582-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461582-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Q/F4zdbT\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnKbM11Frz9sBd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 20:30:06 +1000 (AEST)","(qmail 30789 invoked by alias); 6 Sep 2017 10:29:59 -0000","(qmail 30457 invoked by uid 89); 6 Sep 2017 10:29:58 -0000","from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 06 Sep 2017 10:29:57 +0000","from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 48FB456142;\n\tWed,  6 Sep 2017 06:29:56 -0400 (EDT)","from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\tPGMd7L0ITRnT; Wed,  6 Sep 2017 06:29:56 -0400 (EDT)","from tron.gnat.com (tron.gnat.com\n\t[IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294])\tby rock.gnat.com\n\t(Postfix) with ESMTP id 38B7D5606C;\n\tWed,  6 Sep 2017 06:29:56 -0400 (EDT)","by tron.gnat.com (Postfix, from userid 4192)\tid 3359F32B;\n\tWed,  6 Sep 2017 06:29:56 -0400 (EDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=phE3I9YGCvzLaOw1YFKTBh6EZdYM2KrOpxdBGVbgWolSEBTDPw\n\tkmThBdKLFPA5tXhhE3l73e5maC8xjzdcCNWtT+Co70WwdyGDuTURU9RnHeAMQoI2\n\tBurJxVKZYLakpgOi+3hUn7WP/zRWunytTBiqOkRTYAZ9AgcRCiRj9F8Tg=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=RqiGWQULYRWh5qPcg3WKiSs3aLg=; b=Q/F4zdbTVBhaFIDKEjd6\n\tu0yHwOqR3jLNmVz9z+qew2WfCm5HKlUrSDW7HImjh2SJ3enIR34Lw5hrjvNUuxGZ\n\tzadPAa9nQj7goK2KNVIeHSmpfyf+dMgHZxA8F+kdp5h90exZ6o9+QtVI+E9dhTLg\n\tbWEY5v3J2aaTYKKlkfBnAmY=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=our","X-HELO":"rock.gnat.com","Date":"Wed, 6 Sep 2017 06:29:56 -0400","From":"Arnaud Charlet <charlet@adacore.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Bob Duff <duff@adacore.com>","Subject":"[Ada] Derived iterable types with noniterable parent","Message-ID":"<20170906102956.GA127480@adacore.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"HcAYCG3uE/tztfnV\"","Content-Disposition":"inline","User-Agent":"Mutt/1.5.23 (2014-03-12)"},"content":"This patch fixes a bug in which if a derived type has a Default_Iterator\nspecified, and the parent type does not, then a \"for ... of\" loop causes\nthe compiler to crash. No small test case available.\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-09-06  Bob Duff  <duff@adacore.com>\n\n\t* exp_ch5.adb (Get_Default_Iterator): Replace\n\t\"Assert(False)\" with \"return Iter\", because if an iterable\n\ttype is derived from a noniterable one, then we won't find an\n\toverriding or inherited default iterator.","diff":"Index: exp_ch5.adb\n===================================================================\n--- exp_ch5.adb\t(revision 251767)\n+++ exp_ch5.adb\t(working copy)\n@@ -3934,9 +3934,9 @@\n \n             function Get_Default_Iterator\n               (T : Entity_Id) return Entity_Id;\n-            --  If the container is a derived type, the aspect holds the parent\n-            --  operation. The required one is a primitive of the derived type\n-            --  and is either inherited or overridden. Also sets Container_Arg.\n+            --  Return the default iterator for a specific type. If the type is\n+            --  derived, we return the inherited or overridden one if\n+            --  appropriate.\n \n             --------------------------\n             -- Get_Default_Iterator --\n@@ -3953,11 +3953,11 @@\n             begin\n                Container_Arg := New_Copy_Tree (Container);\n \n-               --  A previous version of GNAT allowed indexing aspects to\n-               --  be redefined on derived container types, while the\n-               --  default iterator was inherited from the parent type.\n-               --  This non-standard extension is preserved temporarily for\n-               --  use by the modelling project under debug flag d.X.\n+               --  A previous version of GNAT allowed indexing aspects to be\n+               --  redefined on derived container types, while the default\n+               --  iterator was inherited from the parent type. This\n+               --  nonstandard extension is preserved for use by the\n+               --  modelling project under debug flag -gnatd.X.\n \n                if Debug_Flag_Dot_XX then\n                   if Base_Type (Etype (Container)) /=\n@@ -3995,9 +3995,11 @@\n                      Next_Elmt (Prim);\n                   end loop;\n \n-                  --  Default iterator must exist\n+                  --  If we didn't find it, then our parent type is not\n+                  --  iterable, so we return the Default_Iterator aspect of\n+                  --  this type.\n \n-                  pragma Assert (False);\n+                  return Iter;\n \n                --  Otherwise not a derived type\n \n","prefixes":["Ada"]}