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: Wed, 26 Apr 2017 08:35:05 +0100 Organization: A noiseless patient Spider Message-ID: References: <934912c8-c189-4d36-8a96-b2aa97e38685@googlegroups.com> <987550450.514781782.903623.laguest-archeia.com@nntp.aioe.org> <8d61281f-e908-4965-a7f4-1e0d4b57c967@googlegroups.com> <20287957.514851298.264687.laguest-archeia.com@nntp.aioe.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="906ec6ba7ed452083f46f9b2c701af04"; logging-data="27291"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NpQfbhNkZZdqfZlHo6Ndp+dR9xzlkTVk=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:nvo/a8jJdH8rGvI2i4yTYm/mJeA= sha1:8/CLpO4yp/JJKUplHz3VUpp16+E= Xref: news.eternal-september.org comp.lang.ada:46627 Date: 2017-04-26T08:35:05+01:00 List-Id: Luke A. Guest writes: > Shark8 wrote: > >>> You'll need to export that as the C memset function. >> >> Even if you're only using it in Ada functions? > > > Yup, GNAT expects certain functions to be present and generates calls > to them. Check system.ads for mention of allowing assignment, that > basically calls memcpy on assignment for objects that require a memory > copy rather than a register to register copy. Not quite sure this is set in system.ads: in the 6.1 sources, the only reference to memset in the compiler itself is in exp_aggr.adb, -- The ultimate goal is to generate a call to a fast memset routine -- specifically optimized for the target. function Aggr_Assignment_OK_For_Backend (N : Node_Id) return Boolean is whereas for System.Support_Composite_Assign there is in sem_ch5.adb -- Check for non-allowed composite assignment if not Support_Composite_Assign_On_Target and then (Is_Array_Type (T1) or else Is_Record_Type (T1)) and then (not Has_Size_Clause (T1) or else Esize (T1) > 64) then Error_Msg_CRT ("composite assignment", N); end if; (don't like the look of that 'Esize (T1) > 64'!)