m68k: Simple loop compiles into boundless recursion with -O2

Alexander Monakov amonakov@ispras.ru
Thu Jan 14 15:05:12 GMT 2021


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.

Alexander


More information about the Gcc-help mailing list