aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/optimize.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/guality/pr86687.C28
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bf6ce97..503d8b4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-31 Tom de Vries <tdevries@suse.de>
+
+ PR debug/86687
+ * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
+
2018-07-31 Jakub Jelinek <jakub@redhat.com>
P1008R1 - prohibit aggregates with user-declared constructors
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 0e9b84e..3923a5f 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -46,6 +46,8 @@ update_cloned_parm (tree parm, tree cloned_parm, bool first)
/* We may have taken its address. */
TREE_ADDRESSABLE (cloned_parm) = TREE_ADDRESSABLE (parm);
+ DECL_BY_REFERENCE (cloned_parm) = DECL_BY_REFERENCE (parm);
+
/* The definition might have different constness. */
TREE_READONLY (cloned_parm) = TREE_READONLY (parm);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 90fb9c1..2cc6973 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-31 Tom de Vries <tdevries@suse.de>
+
+ PR debug/86687
+ * g++.dg/guality/pr86687.C: New test.
+
2018-07-31 Jakub Jelinek <jakub@redhat.com>
P1008R1 - prohibit aggregates with user-declared constructors
diff --git a/gcc/testsuite/g++.dg/guality/pr86687.C b/gcc/testsuite/g++.dg/guality/pr86687.C
new file mode 100644
index 0000000..140a6fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/guality/pr86687.C
@@ -0,0 +1,28 @@
+// PR debug/86687
+// { dg-do run }
+// { dg-options "-g" }
+
+class string {
+public:
+ string (int p) { this->p = p ; }
+ string (const string &s) { this->p = s.p; }
+
+ int p;
+};
+
+class foo {
+public:
+ foo (string dir_hint) {
+ p = dir_hint.p; // { dg-final { gdb-test . "dir_hint.p" 3 } }
+ }
+
+ int p;
+};
+
+int
+main (void)
+{
+ string s = 3;
+ foo bar(s);
+ return !(bar.p == 3);
+}