From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: avoiding builtin memset Date: Thu, 27 Apr 2017 08:09:12 +0100 Organization: A noiseless patient Spider Message-ID: References: <934912c8-c189-4d36-8a96-b2aa97e38685@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="08a00436835937e120380cd593f6eb46"; logging-data="25114"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fHAmcv9XNXOEj42TiJWA9MVM0SUEAziE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:B1CB+LJsbL61CNgahWY7aQAKeRQ= sha1:feu1QP9mBVJLKMPClknZ2F/21ug= Xref: news.eternal-september.org comp.lang.ada:46640 Date: 2017-04-27T08:09:12+01:00 List-Id: "J-P. Rosen" writes: > Le 27/04/2017 à 02:22, Jere a écrit : >>> For Element of Memory loop >>> Element := Value; >>> end loop; >> >> I'll be honest, I wasn't expecting it to avoid memset (didn't see why >> it should), but it didn't recursively call it. It did however, do a >> very interesting loop unroll: >> [...] > What if you replace the loop with: > Memory := (others => Value); That's when the generated code calls memset(3). Unless, I guess, you've set System up to forbid composite assignments? I changed my (Cortex) system.ads to Support_Aggregates : constant Boolean := False; and this code -- Initialize BSS in SRAM Bss := (others => 0); results in startup.adb:113:14: aggregate not supported by configuration whereas system.ads: Support_Composite_Assign : constant Boolean := False; results in startup.adb:113:11: composite assignment not supported by configuration