https://gcc.gnu.org/g:6c0f06cdba12eeb51d3ca0f035e6e370779027f8

commit r16-5257-g6c0f06cdba12eeb51d3ca0f035e6e370779027f8
Author: Andrew Pinski <[email protected]>
Date:   Wed Nov 12 01:30:30 2025 -0800

    fix handling of mapped and their location
    
    So when we using the newly mapped location, we should check if
    it is not unknown location and if so just use the original location.
    Note this is a latent bug in remove_forwarder_block_with_phi code too.
    
    This fixes gcc.dg/uninit-pr40635.c when doing more mergephi.
    
    gcc/ChangeLog:
    
            * tree-cfg.cc (copy_phi_arg_into_existing_phi): Use the original 
location
            if the mapped location is unknown.
    
    Signed-off-by: Andrew Pinski <[email protected]>

Diff:
---
 gcc/tree-cfg.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 5a082eee5243..1d20e6ab6ba4 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -6828,7 +6828,10 @@ copy_phi_arg_into_existing_phi (edge src_e, edge tgt_e, 
bool use_map)
              if (val == old_arg)
                {
                  val = new_arg;
-                 locus = redirect_edge_var_map_location (vm);
+                 location_t locus1 = redirect_edge_var_map_location (vm);
+                 /* Don't remove the location if we remap one does not have 
one.  */
+                 if (locus1 != UNKNOWN_LOCATION)
+                   locus = locus1;
                  break;
                }
            }

Reply via email to