Re: Crash when cross compiling for ARM with GCC-8-2-0 and -ftree-loop-distribute-patterns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx
Geschäftsführer Martin Reuter             HRB 171775 Amtsgericht München

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux