Hello,

I noticed that several division related routines provided by libgcc such as __divdi3, __moddi3 and __umoddi3 have references to _Unwind_Resume for the sparc-rtems target. For example:

        .file   "libgcc2.c"
! GNU C17 (GCC) version 13.0.0 20220621 (experimental) [master r13-1187-gab981aab92c] (sparc-rtems6) ! compiled by GNU C version 12.1.1 20220517 [revision 325d82b08696da17fb26bd2e1b6ba607649357fb], GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.16.1-GMP

! GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
! options passed: -msoft-float -mcpu=leon3 -g -g -g -O0 -O2 -O0 -fbuilding-libgcc -fno-stack-protector -fexceptions -fnon-call-exceptions -fvisibility=hidden

.LLBE7:
.LLBE6:
! /home/EB/sebastian_h/src/gcc/libgcc/libgcc2.c:1225: w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0);
        .loc 1 1225 5
        std     %g2, [%fp-16]   ! D.3900, w
! /home/EB/sebastian_h/src/gcc/libgcc/libgcc2.c:1226:   if (c)
        .loc 1 1226 6
        ld      [%fp-4], %g1    ! c, tmp284
        cmp     %g1, 0  ! tmp284,
        be      .LL25
         nop            !
        b       .LL28
         nop    !
.LL27:
        mov     %i0, %g1        !, tmp283
        mov     %g1, %o0        ! D.3909,
.LLEHB2:
        call    _Unwind_Resume, 0
         nop    !,
.LL28:

Could someone please give me a hint, why the compiler generates this code? I was unable to figure this out by looking at the pre-processed code. I tried to reproduce it with a simple division by zero test case, but this didn't work:

unsigned f(unsigned i)
{
        return i / 0;
}

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

Reply via email to