| Summary: | ICE using _Cilk_spawn in template function | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Peter Osterlund <peterosterlund2> |
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 24 | CC: | davejohansen, jakub, jwakely, law, mpolacek |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-08 16:59:58 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
This message is a reminder that Fedora 24 is nearing its end of life. Approximately 2 (two) weeks from now Fedora will stop maintaining and issuing updates for Fedora 24. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '24'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 24 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. |
Description of problem: In an attempt to optimize a recursive search algorithm using cilkplus and C++ templates to avoid cilk overhead for small sub-trees, the compiler gave an internal error. Version-Release number of selected component (if applicable): g++ (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3) How reproducible: always Steps to Reproduce: 1. Save the following code in a file test.C: template<bool spawn> int fib(int n) { if (n < 2) return n; bool deep = n > 30; int x, y; if (spawn && deep) { x = _Cilk_spawn fib<true>(n-1); y = fib<true>(n-2); } else { x = fib<false>(n-1); y = fib<false>(n-2); } if (spawn && deep) _Cilk_sync; return x + y; } int main() { return fib<true>(42) % 2; } 2. Compile with the following command: g++ -fcilkplus -O2 -Wall -o test test.C Actual results: test.C: In function ‘int fib(int) [with bool spawn = true]’: test.C:10:38: internal compiler error: in cp_gimplify_expr, at cp/cp-gimplify.c:737 x = _Cilk_spawn fib<true>(n-1); ^ Expected results: A valid executable file. Additional info: I can reproduce this error also with g++ 6.2.0 from gcc.gnu.org. A workaround is to introduce an extra variable, i.e. change this: x = _Cilk_spawn fib<true>(n-1); to this: int x1 = _Cilk_spawn fib<true>(n-1); x = x1; This however exposes a second problem. The resulting program is slower than the corresponding serial version, which suggests that the overhead introduced by the cilk keywords can not be optimized out when the <false> version of the template function is instantiated. If I manually create two separate functions I do get the expected speedup, but this is not practical for more complicated real world cases.