1 Star 1 Fork 139

zhouxudong8/gcc

forked from src-openEuler/gcc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
delete-incorrect-smw.patch 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
eastb233 提交于 2020-05-14 10:48 . Init gcc-9.3.0
diff -uprN a/gcc/testsuite/gcc.dg/pr91195.c b/gcc/testsuite/gcc.dg/pr91195.c
new file mode 100644
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr91195.c
@@ -0,0 +1,25 @@
+/* PR middle-end/91195 */
+/* { dg-do compile } */
+/* { dg-options "-Wmaybe-uninitialized -O2" } */
+
+int bar (char*);
+
+void
+foo (char *x, char *y)
+{
+ char *a[2];
+ int b = 0;
+
+ if (x)
+ a[b++] = x; /* { dg-bogus "may be used uninitialized in this function" } */
+ if (y)
+ a[b++] = y;
+
+ for (int j = 0; j < 4; j++)
+ switch (j)
+ {
+ case 0:
+ if (b == 0 || bar (a[0]))
+ break;
+ }
+}
diff -uprN a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -2269,6 +2269,10 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
new_stmt = gimple_build_assign (name, lhs);
gimple_set_location (new_stmt, locus);
+ lhs = unshare_expr (lhs);
+ /* Set TREE_NO_WARNING on the rhs of the load to avoid uninit
+ warnings. */
+ TREE_NO_WARNING (gimple_assign_rhs1 (new_stmt)) = 1;
gsi_insert_on_edge (e1, new_stmt);
/* 3) Create a PHI node at the join block, with one argument
@@ -2279,7 +2283,6 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
add_phi_arg (newphi, rhs, e0, locus);
add_phi_arg (newphi, name, e1, locus);
- lhs = unshare_expr (lhs);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
/* 4) Insert that PHI node. */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhouxudong8/gcc.git
git@gitee.com:zhouxudong8/gcc.git
zhouxudong8
gcc
gcc
master

搜索帮助