From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40893 invoked by alias); 16 Oct 2019 13:19:05 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 40885 invoked by uid 89); 16 Oct 2019 13:19:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=ideas X-HELO: mail.inka.de Received: from quechua.inka.de (HELO mail.inka.de) (193.197.184.2) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2019 13:19:03 +0000 Received: from raven.inka.de (uucp@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 1iKjCe-0002mt-NN; Wed, 16 Oct 2019 15:19:00 +0200 Received: by raven.inka.de (Postfix, from userid 1000) id 39081120164; Wed, 16 Oct 2019 15:17:59 +0200 (CEST) Date: Wed, 16 Oct 2019 13:19:00 -0000 From: Josef Wolf To: gcc-help@gcc.gnu.org Subject: Crash when cross compiling for ARM with GCC-8-2-0 and -ftree-loop-distribute-patterns Message-ID: <20191016131759.GA11171@raven.inka.de> Mail-Followup-To: Josef Wolf , gcc-help@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00058.txt.bz2 Hello all, I experience target crashing when cross compiling for ARM with -ftree-loop-distribute-patterns, which is enabled by the -O3 flag. The crash happens in the startup code, before main() is called. This startup code looks like this: extern unsigned long _sidata; /* Set by the linker */ extern unsigned long _sdata; /* Set by the linker */ extern unsigned long _sbss; /* Set by the linker */ extern unsigned long _ebss; /* Set by the linker */ void Reet_Handler (void) { unsigned long *src = &_sidata unsigned long *src = &_sdata /* Copy data segment into RAM */ if (src != dst) { while (dst < &_edata) *(dst++) = *(src++); } /* Zero BSS segment */ dst = &_sbss; while (dst < &_ebss) *(dst++) = 0; main(); } With -ftree-loop-distribute-patterns those two loops are replaced by calls to memcpy() and memset(). The memcpy function finishes just fine. But the memset function doesn't seem to finish. It looks like this: void memset (void *s, int c, size_t n) { int i; for (i=0; i