[gcc/devel/ranger] Increase index number for creating temp vars' name.
Aldy Hernandez
aldyh@gcc.gnu.org
Wed Jun 17 18:37:02 GMT 2020
https://gcc.gnu.org/g:a2155f7dd3d8d031607036d40b0fa32f0cb8da52
commit a2155f7dd3d8d031607036d40b0fa32f0cb8da52
Author: Bin Cheng <bin.cheng@linux.alibaba.com>
Date: Wed Feb 5 18:45:08 2020 +0800
Increase index number for creating temp vars' name.
gcc/cp
* coroutines.cc (maybe_promote_captured_temps): Increase the index
number for temporary variables' name.
Diff:
---
gcc/cp/ChangeLog | 5 +++++
gcc/cp/coroutines.cc | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a54c8db23a6..7c24ab8b33b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
+
+ * coroutines.cc (maybe_promote_captured_temps): Increase the index
+ number for temporary variables' name.
+
2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
* coroutines.cc (build_co_await): Call convert_from_reference
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index e24ea7b29ad..0a8a531d6d7 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -2676,12 +2676,12 @@ maybe_promote_captured_temps (tree *stmt, void *d)
/* Collected the scope vars we need move the temps to regular. */
tree aw_bind_body = push_stmt_list ();
tree varlist = NULL_TREE;
- unsigned vnum = 0;
+ int vnum = -1;
while (!awpts->to_replace->is_empty ())
{
size_t bufsize = sizeof ("__aw_.tmp.") + 20;
char *buf = (char *) alloca (bufsize);
- snprintf (buf, bufsize, "__aw_%d.tmp.%d", awpts->count, vnum);
+ snprintf (buf, bufsize, "__aw_%d.tmp.%d", awpts->count, ++vnum);
tree to_replace = awpts->to_replace->pop ();
tree orig_temp;
if (TREE_CODE (to_replace) == CO_AWAIT_EXPR)
More information about the Gcc-cvs
mailing list