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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|debug                       |middle-end
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2025-08-06
                 CC|                            |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So looking into the example further.
What is happening is GCC is duplicating the ret path for the case where the
return value of skip_prefix is 0 and recorded it as part of the inlined
function as the return statement didn't exactly have a line information
associated with it.

```
  [/app/example.cpp:15:7] # DEBUG strD.2803 => NULL
  [/app/example.cpp:15:7] # DEBUG prefixD.2804 => NULL
  [/app/example.cpp:15:7] # DEBUG outD.2805 => NULL
  # DEBUG pathD.2783 => path_14
  [/app/example.cpp:19:3] # DEBUG BEGIN_STMT
  [/app/example.cpp:19:10 discrim 1] # VUSE <.MEM_4(D)>
  return path_14;
```

This is because the return statement lost its location when building ssa.

Before SSA we have:
```
  [/app/example.cpp:19:3] # DEBUG BEGIN_STMT
  [/app/example.cpp:19:10] D.2794 = pathD.2783;
  [/app/example.cpp:19:10 discrim 1] return D.2794;
```

But after we get:
```
  _12 = pathD.2783;
  [/app/example.cpp:19:10 discrim 1] # VUSE <.MEM_8>
  return _12;
;;    succ:       EXIT /app/example.cpp:19:10
```

Looks like we also lost the line info for the `D.2794 = pathD.2783;` assignment
too.

I will take a look soon on why the line info is lost.

Reply via email to