[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2022-01-06 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033
Bug 93033 depends on bug 66139, which changed state.

Bug 66139 Summary: destructor not called for members of partially constructed 
anonymous struct/array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66139

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-13 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #19 from Jason Merrill  ---
*** Bug 93077 has been marked as a duplicate of this bug. ***

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from Jason Merrill  ---
Hopefully really fixed now.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #17 from Jason Merrill  ---
Author: jason
Date: Fri Jan 10 18:46:57 2020
New Revision: 280126

URL: https://gcc.gnu.org/viewcvs?rev=280126&root=gcc&view=rev
Log:
PR c++/93173 - incorrect tree sharing.

My patch for 93033 wasn't sufficient to handle all the possible sharing
introduced by split_nonconstant_init, and it occurred to me that it would
make sense to use the same unsharing technique as unshare_body, namely
copy_if_shared.

PR c++/93033
gcc/
* gimplify.c (copy_if_shared): No longer static.
* gimplify.h: Declare it.
gcc/cp/
* cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
copy_if_shared after cp_genericize_tree.
* typeck2.c (split_nonconstant_init): Don't unshare here.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/initlist-new3.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-gimplify.c
trunk/gcc/cp/typeck2.c
trunk/gcc/gimplify.c
trunk/gcc/gimplify.h

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Richard Biener  changed:

   What|Removed |Added

 Status|REOPENED|NEW

--- Comment #16 from Richard Biener  ---
Re-confirmed, still broken.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-06 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

David Binderman  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #15 from David Binderman  ---
Reduced C++ code seems to be:

struct a {
  char b;
};
class c {
public:
  c(c const &);
  ~c();
};
struct d {
  enum e {};
};
struct f {
  c g;
  a h;
  c i;
  d::e j;
};
class k {
  f l;
  k(c const &, a const &, c, d::e);
};
k::k(c const &g, a const &h, c i, d::e j) : l{g, h, i, j} {}

Flag -march=native not required now.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-06 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #14 from David Binderman  ---
Created attachment 47598
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47598&action=edit
gzipped C++ source code

The attached C++ source code seems to be still broken.

-march=native (aka bdver2) seems to be required.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-06 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Jason Merrill  ---
Fixed.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-06 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #12 from Arseny Solokha  ---
I believe this PR can be closed now.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-03 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #11 from Jason Merrill  ---
Author: jason
Date: Fri Jan  3 22:10:56 2020
New Revision: 279871

URL: https://gcc.gnu.org/viewcvs?rev=279871&root=gcc&view=rev
Log:
PR c++/93033 - incorrect tree node sharing with array init.

The split_nonconstant_init piece is the only one necessary to fix the
testcase, but it occurred to me that we might as well not split when
-fno-exceptions.

* typeck2.c (split_nonconstant_init): Unshare non-decl.
* cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/initlist-array9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-gimplify.c
trunk/gcc/cp/typeck2.c

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-03 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-03 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Jakub Jelinek  changed:

   What|Removed |Added

 CC||s...@li-snyder.org

--- Comment #10 from Jakub Jelinek  ---
*** Bug 93137 has been marked as a duplicate of this bug. ***

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2020-01-03 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek  ---
Reduced testcase from PR93137:

template 
struct A {
  A ();
  ~A ();
};
template 
A operator+(const T *, A);

void
foo ()
{
  A f;
  struct { A g; bool h; } i[] {"" + f};
}

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-28 Thread raj.khem at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Khem Raj  changed:

   What|Removed |Added

 CC||raj.khem at gmail dot com

--- Comment #8 from Khem Raj  ---
with this patch I dont see the ICE I was seeing in quite a few qt apps as
reported in

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93077

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-27 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #7 from Jan Hubicka  ---
This patch fixes the testcase, but I am not familiar enough with the code to
say if that is correct fix :)

Index: ../../gcc/cp/cp-gimplify.c
===
--- ../../gcc/cp/cp-gimplify.c  (revision 279724)
+++ ../../gcc/cp/cp-gimplify.c  (working copy)
@@ -534,7 +534,7 @@ cp_gimplify_init_expr (tree *expr_p, gim
 {
   gimplify_expr (&to, pre_p, NULL, is_gimple_lvalue, fb_lvalue);
   replace_placeholders (from, to);
-  from = split_nonconstant_init (to, from);
+  from = unshare_expr (split_nonconstant_init (to, from));
   cp_genericize_tree (&from, false);
   *expr_p = from;
   return;

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-27 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Jan Hubicka  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #6 from Jan Hubicka  ---
*** Bug 93079 has been marked as a duplicate of this bug. ***

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-23 Thread zwen7 at binghamton dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

zwen7 at binghamton dot edu changed:

   What|Removed |Added

 CC||zwen7 at binghamton dot edu

--- Comment #5 from zwen7 at binghamton dot edu ---
I am also having the same problem.
My code is here:
https://github.com/zyddnys/PatchyVideo-autocomplete
compile command line: g++ -O3 -std=c++2a -o autocomplete.app autocomplete.cpp
compiler is compiled from latest pull from github.

In file included from autocomplete.cpp:7:
tree.h: In function ‘void AddTag(uint32_t, uint32_t, uint32_t)’:
tree.h:151:6: error: incorrect sharing of tree nodes
  151 | void AddTag(std::uint32_t id, std::uint32_t count, std::uint32_t
category)
  |  ^~
MEM[(struct Tag *)D.232969]
MEM[(struct Tag *)D.232969].count = count;
tree.h:151:6: error: incorrect sharing of tree nodes
MEM[(struct Tag *)D.232969]
MEM[(struct Tag *)D.232969].category = category;
tree.h:151:6: error: incorrect sharing of tree nodes
MEM[(struct Tag *)D.232969]
MEM[(struct Tag *)D.232969].lang_keywords = {};
tree.h:151:6: error: incorrect sharing of tree nodes
MEM[(struct Tag *)D.232969]
MEM[(struct Tag *)D.232969].alias_keywords = {};
during GIMPLE pass: cfg
tree.h:151:6: internal compiler error: verify_gimple failed
0x1013f4a verify_gimple_in_cfg(function*, bool)
../.././gcc/tree-cfg.c:5445
0xefad8f execute_function_todo
../.././gcc/passes.c:1983
0xefbbcc do_per_function
../.././gcc/passes.c:1638
0xefbbcc execute_todo
../.././gcc/passes.c:2037
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


gcc -v:
sing built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --with-pkgversion=somegcc --disable-multilib
--enable-languages=c,c++,lto --disable-bootstrap : (reconfigured) ./configure
--with-pkgversion=somegcc --disable-multilib --enable-languages=c,c++,lto
--disable-bootstrap : (reconfigured) ./configure --with-pkgversion=patchygcc
--disable-multilib --enable-languages=c,c++,lto --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.0 20191223 (experimental) (somegcc)

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

--- Comment #4 from Marek Polacek  ---
template  struct S {
  S(T *);
  ~S();
};
struct X {
  struct C {
S d;
float e;
  };
  X();
};
S f(S);
X::X() { C a[]{f("")}; }

$ ./cc1plus -quiet 93033.C
93033.C: In constructor ‘X::X()’:
93033.C:13:1: error: incorrect sharing of tree nodes
   13 | X::X() { C a[]{f("")}; }
  | ^
*D.2489
D.2489->d = f (&D.2492); [return slot optimization]
during GIMPLE pass: cfg
93033.C:13:1: internal compiler error: verify_gimple failed
0x1525a5a verify_gimple_in_cfg(function*, bool)
/home/mpolacek/src/gcc/gcc/tree-cfg.c:5445
0x1351abd execute_function_todo
/home/mpolacek/src/gcc/gcc/passes.c:1983
0x1350a9a do_per_function
/home/mpolacek/src/gcc/gcc/passes.c:1638
0x1351cad execute_todo
/home/mpolacek/src/gcc/gcc/passes.c:2037

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Marek Polacek  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
Which it couldn't have, because it hadn't been broken yet.

Started with r279576.

[Bug c++/93033] [10 Regression] error: incorrect sharing of tree nodes

2019-12-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93033

Marek Polacek  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-12-20
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |10.0
Summary|error: incorrect sharing of |[10 Regression] error:
   |tree nodes  |incorrect sharing of tree
   ||nodes
 Ever confirmed|0   |1

--- Comment #2 from Marek Polacek  ---
Confirmed with latest trunk, that is, r279447 didn't fix it.