https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114222

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Ultimately this is a newlib/libgloss problem:

jlaw@x11-dpi:~/test/obj/h8/newlib$ h8300-elf-objdump -dr !$
h8300-elf-objdump -dr ./h8300-elf/normal/newlib/libc/misc/libc_a-ffs.o

./h8300-elf/normal/newlib/libc/misc/libc_a-ffs.o:     file format elf32-h8300


Disassembly of section .text:

00000000 <_ffs>:
   0:   5e 00 00 00     jsr     @0x0:24
                        1: R_H8_DIR24R8 _ffs


That's infinite recursion.  At some point the stack is going to smash into the
text segment as the stack starts out at a higher address and grows to lower
addresses, eventually overwriting the code for _ffs.  Once that happens we no
longer get infinite recursion, but instead start trying to execute whate values
were written into the code segment (return addresses from the recursive calls)
-- ultimately going off into the weeds and getting an SIGILL eventually.

This bug needs to get refiled over in the newlib-cygwin project.   I'd hazard a
guess that ffs in newlib needs to be compiled with the loop distribution pass
disabled to prevent this kind of problem.

Reply via email to