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

--- Comment #5 from Fabio Porcedda <fabio.porcedda at gmail dot com> ---
(In reply to David Malcolm from comment #3)
> Should be fixed on trunk for gcc 16 by the above patch.
> 
> Keeping open to track backporting.

Hi David,
thanks for the fix.
I've tried the fix and i confirm that fixes the test.c but it is still present
with a slightly different code, please check test2.c

test2.c: In function ‘fun’:
test2.c:4:9: warning: infinite recursion [CWE-674]
[-Wanalyzer-infinite-recursion]
    4 |         fun(x, 8 - x);
      |         ^~~~~~~~~~~~~
  ‘fun’: events 1-4
    │
    │    1 | void fun(int x, int y)
    │      |      ^~~
    │      |      |
    │      |      (1) entry to ‘fun’
    │    2 | {
    │    3 |     if (x + y > 8)
    │      |        ~
    │      |        |
    │      |        (2) following ‘true’ branch... ─>─┐
    │      |                                          │
    │      |                                          │
    │      |┌─────────────────────────────────────────┘
    │    4 |│        fun(x, 8 - x);
    │      |│        ~~~~~~~~~~~~~
    │      |│        |
    │      |└───────>(3) ...to here
    │      |         (4) calling ‘fun’ from ‘fun’
    │
    └──> ‘fun’: events 5-8
           │
           │    1 | void fun(int x, int y)
           │      |      ^~~
           │      |      |
           │      |      (5) initial entry to ‘fun’
           │    2 | {
           │    3 |     if (x + y > 8)
           │      |        ~
           │      |        |
           │      |        (6) following ‘true’ branch... ─>─┐
           │      |                                          │
           │      |                                          │
           │      |┌─────────────────────────────────────────┘
           │    4 |│        fun(x, 8 - x);
           │      |│        ~~~~~~~~~~~~~
           │      |│        |
           │      |└───────>(7) ...to here
           │      |         (8) calling ‘fun’ from ‘fun’
           │
           └──> ‘fun’: events 9-10
                  │
                  │    1 | void fun(int x, int y)
                  │      |      ^~~
                  │      |      |
                  │      |      (9) recursive entry to ‘fun’; previously
entered at (5)
                  │      |      (10) ⚠️  apparently infinite recursion
                  │

Could you please fix this as well?

Thanks

Reply via email to