From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 0CCB138708CE for ; Thu, 14 Jan 2021 15:09:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0CCB138708CE Received: from monopod.intra.ispras.ru (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id E26C940A92A3; Thu, 14 Jan 2021 15:09:48 +0000 (UTC) Date: Thu, 14 Jan 2021 18:09:48 +0300 (MSK) From: Alexander Monakov To: Fredrik Noring cc: gcc-help@gcc.gnu.org, Stefan Franke , Segher Boessenkool Subject: Re: m68k: Simple loop compiles into boundless recursion with -O2 In-Reply-To: Message-ID: References: <20210113192015.GT30983@gate.crashing.org> <20210113214605.GU30983@gate.crashing.org> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2021 15:09:51 -0000 On Thu, 14 Jan 2021, Alexander Monakov via Gcc-help wrote: > On Thu, 14 Jan 2021, Fredrik Noring wrote: > > > > __attribute__((optimize("no-tree-loop-distribute-patterns"))) > > > void *memset2(void *s, int c, unsigned int n) > > > { > > > ... > > > > This works, too, and I prefer it because the __attribute__ is attached > > to the code itself. > > Just keep in mind that this attribute is currently not intended for use > apart from debugging/testing: > > https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-optimize-function-attribute > > The optimize attribute should be used for debugging purposes only. It is not > suitable in production code. (part of the reason for that being that the interaction of the attribute with options passed on the command line is poorly defined: currently adding the attribute results in other -O and -f options dropped for the function, IIRC; this should have gone out with the previous email, sorry about sending that prematurely) > Alexander >