https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121424
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > 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. Wait I am reading the thing wrong. The lines # are correct after SSA: ``` [/app/example.cpp:19:10] # VUSE <.MEM_8> _12 = pathD.2783; [/app/example.cpp:19:10 discrim 1] # VUSE <.MEM_8> return _12; ``` I missed that the virtual op part creates a newline in the dump. After eiline there is a missing line #: ``` # DEBUG path => path_25 [/app/example.cpp:19:3] # DEBUG BEGIN_STMT [/app/example.cpp:19:10] _12 = path_25; [/app/example.cpp:19:10 discrim 1] return _12; ``` On the debug statement. still trying to figure it out.