[Bug c++/80038] Random segfault using local vectors in Cilk function

2017-03-16 Thread cont...@edgar-fournival.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80038

--- Comment #11 from Edgar Fournival  ---
It is also interesting to note that GCC 5.x is not impacted.

Even if the given example code will not compile on GCC 5 (ICE in lower_stmt, at
gimple-low.c:397 for the line "cilk_spawn walk(vnew, size);"), we discovered
the bug in this project:
https://github.com/hivert/NumericMonoid/tree/master/src/Cilk%2B%2B (source)
https://github.com/hivert/NumericMonoid/issues/2 (results, unfortunately in
French)
Which does compile under GCC 5.

The quick tests done on my machine show that something between GCC 5.4.0 and
GCC 6.3.1 introduced the destructor bug.

[Bug c++/80038] Random segfault using local vectors in Cilk function [Regression 6/7]

2017-03-16 Thread cont...@edgar-fournival.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80038

--- Comment #15 from Edgar Fournival  ---
(In reply to Xi Ruoyao from comment #14)
> Although I don't understand all the code in the Github repo, but GCC 6 indeed
> moved the temporary construction (initialization) and destruction code to the
> parent, and violated cilkplus spec.  So it's very sure this is a regression
> of GCC.

Sorry for this, I should have been more specific. The code we have that uses
Cilk is located in treewalk.cpp:49:
https://github.com/hivert/NumericMonoid/blob/master/src/Cilk%2B%2B/treewalk.cpp#L49
We fixed it with this:
https://github.com/hivert/NumericMonoid/pull/3/commits/bf8898dce0276b8568e867b6ff255a1c9a0fa434

Unfortunately, this is the only thing we have that demonstrates the bug *and*
compiles under GCC 5. A shorter and simpler example would be really helpful but
I have no clue how to workaround the ICE.

Xi Ruoyao, do you know which commit would be involved? If not, what are the
typical process used to find out the modification which introduced the bug?
Bisection?

[Bug c++/80038] Random segfault using local vectors in Cilk function [Regression 6/7]

2017-03-16 Thread cont...@edgar-fournival.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80038

--- Comment #19 from Edgar Fournival  ---
Thanks for your explanations. I will investigate on my side and check the
generated assembly of our project. Please keep us posted with the results of
your bisection.