From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp01.hesbynett.no (smtp01.hesbynett.no [81.29.32.167]) by sourceware.org (Postfix) with ESMTPS id E11413858C54 for ; Tue, 28 Nov 2023 18:00:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E11413858C54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hesbynett.no Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hesbynett.no ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E11413858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=81.29.32.167 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701194424; cv=none; b=aVSJbVriqS1oiJ+4hYaZ3y3d8LQDNzIaDdfUoeapYqB51bP10zMMf2a5SFBLu3ThoAxRCAfpnB119Tv7fSCgbXKn/MQH4SQ4mgyAf0uNzKDMgoAw2zEY8akqZNtJ1la4kWl+HcZPGDntOOgncKL1Ctl5juJoDkDahCWbv6FTpAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701194424; c=relaxed/simple; bh=/79RU1ejPHFVpPGrPcuQpcBstWVWpeVqvu5ZcnixY2E=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=vfK7W21vY6T0tZG8IHl3q1NC1I/Of5CT4v2XOHQ0iCqTZA52AKpdUMrysyWDn1+Nv7/4SqVZ6isxgNKApPjFIDX597+LYVJz/ggnMjGp2GzupVt2sT2jAo+yBkPFKxE+qSVtsaLei0yW6vlP5EkTLMw/DIASScu1xAq1n9Smef4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [IPV6:2a01:799:443:8d00:641:d868:752f:5153] (unknown [IPv6:2a01:799:443:8d00:641:d868:752f:5153]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ma-4381) by smtp01.hesbynett.no (Postfix) with ESMTPSA id 97A7020249; Tue, 28 Nov 2023 19:00:05 +0100 (CET) Message-ID: Date: Tue, 28 Nov 2023 19:00:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: arm-none-eabi, nested function trampolines and caching Content-Language: en-GB To: edd.robbins@gmail.com, Matthias Pfaller , gcc-help@gcc.gnu.org Cc: Ed Robbins References: <8342aeef-4eef-231b-bf45-416660954fdb@marco.de> From: David Brown In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3032.0 required=5.0 tests=BAYES_00,GB_TO_NAME_FREEMAIL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 28/11/2023 10:51, Ed Robbins via Gcc-help wrote: > On Tue, 28 Nov 2023 at 07:21, Matthias Pfaller wrote: >> >> On 2023-11-27 16:16, Ed Robbins via Gcc-help wrote: >>> Hello, >>> I am using gcc-arm-none-eabi with a cortex M7 device, with caches >>> (data/instruction) enabled. Nested function calls result in a usage fault >>> because there is no clear cache call for this platform. >>> >> I have lots of code with nested functions. When switching to gcc-12 I got random >> crashes on my cortex-m7 targets. In order to get that working again I had to patch >> gcc/config/arm/arm.h: >> Can I ask (either or both of you) why you are using are using nested functions like this? This is possibly the first time I have heard of anyone using them, certainly the first time in embedded development. Even when I programmed in Pascal, where nested functions are part of the language, I did not use them more than a couple of times. What benefit do you see in nested functions in C, compared to having separate functions? Have you considered moving to C++ and using lambdas, which are more flexible, standard, and can be very much more efficient? This is, of course, straying from the topicality of this mailing list. But I am curious, and I doubt if I am the only one who is. David