Hi!

On 2021-11-09T21:28:43-0700, Martin Sebor via Gcc-patches 
<gcc-patches@gcc.gnu.org> wrote:
> The attached patch adds support to the middle end for detecting
> infinitely recursive calls.  The warning is controlled by the new
> -Winfinite-recursion option.  The option name is the same as
> Clang's.

Thanks!

> The warning detects a superset of problems detected by Clang
> (based on its tests).  It detects the problem in PR88232
> (the feature request) as well as the one in PR 87742,
> an unrelated problem report that was root-caused to bug due
> to infinite recursion.

... and I'm thus confirming that it also would have caught
PR101204 "infinite recursion in gtype-desc.c since
r12-1801-g7036e9ef462fde8181bece4ac4e03f3aa27204dc":

    [...]
    gtype-desc.c: In function ‘void gt_pch_nx(int_hash<unsigned int, 0, 
4294967295>*, gt_pointer_operator, void*)’:
    gtype-desc.c:11311:1: error: infinite recursion detected 
[-Werror=infinite-recursion]
    11311 | gt_pch_nx (int_hash<location_t,0,UINT_MAX>* x ATTRIBUTE_UNUSED,
          | ^~~~~~~~~
    gtype-desc.c:11315:15: note: recursive call
    11315 |     gt_pch_nx (&((*x)), op, cookie);
          |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
    cc1plus: all warnings being treated as errors
    make[3]: *** [gtype-desc.o] Error 1
    make[3]: Leaving directory `[...]/build-gcc/gcc'
    make[2]: *** [all-stage2-gcc] Error 2
    make[2]: Leaving directory `[...]/build-gcc'
    make[1]: *** [stage2-bubble] Error 2
    make[1]: Leaving directory `[...]/build-gcc'
    make: *** [all] Error 2

That's with recent fix-up commit c71cb26a9e841888f52e4bfcaad94c8f8ecb4fdb
"Get rid of infinite recursion for 'typedef' used with GTY-marked
'gcc/diagnostic-spec.h:nowarn_map' [PR101204, PR103157]" temporarily
reverted (and commit f861ed8b29a5eb6164d1ddbcfbb6232dddae713f
"Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map'" as a
prerequisite, too).


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to