- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was trying to use built-in functions for arrays in cilkplus. Consider the following code as example:
#include<stdio.h> #include<stdlib.h> #include<cilk/cilk.h> int main() { int a[10] = {10,3,14,7,9,5,65,12,6,52}; int t; t = __sec_reduce_max(a[0:3]); cilk_for(int i=0;i<11;i++) { printf("something\n"); } return 0; }
On compiling the above program i got "internal compiler error: Segmentation fault"
But, if i replace the "cilk_for" with just "for" then the program is compiled and executed successfully. I observed that whenever i'm using cilk_for and the function __sec_reduce_max() within the same program, i get this error. Is this a bug
I think the question is similar to this one? But what's the solution? what should i do? I'm using cilkplus-4_8-branch in linux 64 bit system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. The C compiler of GCC5 compiles your second example without any problems, but the C++ compiler is crashing as described in your posting, so it looks like a bug in g++.
2. The correct function name is __sec_reduce_max_ind() as described in https://www.cilkplus.org/sites/default/files/open_specifications/Intel_Cilk_plus_lang_spec_1.2.htm. I found that the tutorial page at cilkplus.org contains incorrect information about this function, so it needs correction.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it looks like a bug in cilkplus-4_8-branch.
If you don't have any specific reason to use cilkplus-4_8-branch, you can use the latest GCC version (gcc-5) instead. Your example code compiles fine with gcc-5, so I believe the bug was fixed in the latest version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for quick reply.
This program is running fine with g++-5 but i got some other problems too.
1. On using __sec_reduce_max() inside the cilk_for loop giving me "internal compiler error: in gimplify_expr , at gimplify.c:8832". For instance consider the following code:
#include<stdio.h> #include<stdlib.h> #include<cilk/cilk.h> int main() { int a[10] = {10,3,14,7,9,5,65,12,6,52}; int t; cilk_for(int i = 0;i<4;i++) { t = __sec_reduce_max(a[0:i+1]); } return 0; }
I got following message:
internal compiler error: in gimplify_expr, at gimplify.c:8832
t = __sec_reduce_max(a[0:i+1]);
^
0x8f19fc gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8832
0x8f5540 gimplify_call_expr
../../src/gcc/gimplify.c:2477
0x8f1297 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8071
0x8ee803 gimplify_modify_expr
../../src/gcc/gimplify.c:4644
0x8effba gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8100
0x8f27a6 gimplify_stmt(tree_node**, gimple_statement_base**)
../../src/gcc/gimplify.c:5519
0x8ef8ab gimplify_cleanup_point_expr
../../src/gcc/gimplify.c:5295
0x8ef8ab gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8463
0x8f27a6 gimplify_stmt(tree_node**, gimple_statement_base**)
../../src/gcc/gimplify.c:5519
0x8f82f7 gimplify_and_add(tree_node*, gimple_statement_base**)
../../src/gcc/gimplify.c:423
0x8f82f7 gimplify_omp_for
../../src/gcc/gimplify.c:7413
0x8f0efc gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8562
0x8f27a6 gimplify_stmt(tree_node**, gimple_statement_base**)
../../src/gcc/gimplify.c:5519
0x8f2fbf gimplify_bind_expr
../../src/gcc/gimplify.c:1136
0x8f1279 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8297
0x8f27a6 gimplify_stmt(tree_node**, gimple_statement_base**)
../../src/gcc/gimplify.c:5519
0x8f2063 gimplify_and_add(tree_node*, gimple_statement_base**)
../../src/gcc/gimplify.c:423
0x8f2063 gimplify_and_return_first
../../src/gcc/gimplify.c:435
0x8f2063 gimplify_omp_parallel
../../src/gcc/gimplify.c:6901
0x8f2063 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
../../src/gcc/gimplify.c:8547
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
2. It is not recognizing __sec_reduce_max_index function
‘__sec_reduce_max_index’ was not declared in this scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. The C compiler of GCC5 compiles your second example without any problems, but the C++ compiler is crashing as described in your posting, so it looks like a bug in g++.
2. The correct function name is __sec_reduce_max_ind() as described in https://www.cilkplus.org/sites/default/files/open_specifications/Intel_Cilk_plus_lang_spec_1.2.htm. I found that the tutorial page at cilkplus.org contains incorrect information about this function, so it needs correction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you are right. Gcc-5 is compiling it without any problems. Thanks a lot.
It's very confusing, so many bugs and errors. Btw, do i need to report these bugs and errors somewhere or it will be handled by someone now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Somebody will be looking at the issue.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page