Crash when cross compiling for ARM with GCC-8-2-0 and -ftree-loop-distribute-patterns
Matthias Pfaller
leo@marco.de
Wed Oct 16 13:30:00 GMT 2019
On 10/16/19 3:17 PM, Josef Wolf wrote:
> 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<n; i++)
> ((char *)s)[i] = c;
> }
>
> Any ideas why this function is crashing? I can't see anything suspicious here.
>
> Thanks
Is your stack part of the BSS? In that case the call to memset will
cause a crash.
Matthias
--
Matthias Pfaller Software Entwicklung
marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 41
Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66
http://www.marco.de/ Email leo@marco.de
Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3591 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20191016/12a0374b/attachment.p7s>
More information about the Gcc-help
mailing list