aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.cc
diff options
context:
space:
mode:
authorQing Zhao <qing.zhao@oracle.com>2023-02-28 17:11:05 +0000
committerQing Zhao <qing.zhao@oracle.com>2023-02-28 17:11:05 +0000
commitafe6cea4489846aa8585f3c045d16cdaa08cc6cd (patch)
treecab3f29c0fd562f30d4adcc05e7a685ca604f5ac /gcc/cp/pt.cc
parent62ed1066196c81ab1fad13b2cc5ebbfe887138f9 (diff)
downloadgcc-afe6cea4489846aa8585f3c045d16cdaa08cc6cd.zip
gcc-afe6cea4489846aa8585f3c045d16cdaa08cc6cd.tar.gz
gcc-afe6cea4489846aa8585f3c045d16cdaa08cc6cd.tar.bz2
Fixing PR107411
This is a bug in tree-ssa-uninit.cc. When doing the following: /* Ignore the call to .DEFERRED_INIT that define the original var itself as the following case: temp = .DEFERRED_INIT (4, 2, “alt_reloc"); alt_reloc = temp; In order to avoid generating warning for the fake usage at alt_reloc = temp. */ We need to compare the var name inside the .DEFERRED_INIT call (the 3rd argument) and the name for the LHS variable. if they are the same, we will NOT report the warning. There is one issue when we get the name for the LHS variable. when the variable doesn't have a DECL_NAME (it's not a user declared variable, which is the case for this bug): _1 = .DEFERRED_INIT (4, 2, &"D.2389"[0]); D.2389 = _1; The current checking just ignores this case, and still report the warning. The fix is very simple, when getting the name for the LHS variable, we should consider this case and come up with the name the same way as we construct the 3rd argument for the call to .DEFERRED_INIT (please refer to the routine "gimple_add_init_for_auto_var") PR middle-end/107411 gcc/ChangeLog: PR middle-end/107411 * gimplify.cc (gimple_add_init_for_auto_var): Use sprintf to replace xasprintf. * tree-ssa-uninit.cc (warn_uninit): Handle the case when the LHS varaible of a .DEFERRED_INIT call doesn't have a DECL_NAME. gcc/testsuite/ChangeLog: PR middle-end/107411 * g++.dg/pr107411.C: New test.
Diffstat (limited to 'gcc/cp/pt.cc')
0 files changed, 0 insertions, 0 deletions