Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++][Compute]Compiler error with gcc7 and c++17 #32818

Closed
asfimport opened this issue Aug 30, 2022 · 1 comment
Closed

[C++][Compute]Compiler error with gcc7 and c++17 #32818

asfimport opened this issue Aug 30, 2022 · 1 comment

Comments

@asfimport
Copy link

asfimport commented Aug 30, 2022

When compiling the c++ compute component with gcc6/7 with std=c++14/17, compiler internal errors are triggered at compute/kernels/aggregate_internal.h:176:24 and various places at compute/kernels/scalar_set_lookup.cc

cpp/src/arrow/compute/kernels/aggregate_internal.h:176:24internal compiler errorin maybe_undo_parenthesized_ref, at cp/semantics.c:1740
DCHECK_LT(cur_level, levels);
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
0x683399 maybe_undo_parenthesized_ref(tree_node*)
../../gcc-7.5.0/gcc/cp/semantics.c:1739
0x6c8638 cp_fold
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2180
0x6c949c cp_fold_maybe_rvalue
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2042
0x6c8346 cp_fold
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2149
0x6c949c cp_fold_maybe_rvalue
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2042
0x6c8234 cp_fold_rvalue
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2063
0x6c8234 cp_fold
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2304
0x66a037 cp_convert_and_check(tree_node*, tree_node*, int)
../../gcc-7.5.0/gcc/cp/cvt.c:640
0x59bb8a convert_like_real
../../gcc-7.5.0/gcc/cp/call.c:7053
0x59de12 build_over_call
../../gcc-7.5.0/gcc/cp/call.c:7869
0x5a3c2f build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, int)
../../gcc-7.5.0/gcc/cp/call.c:4272
0x685601 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int)
../../gcc-7.5.0/gcc/cp/semantics.c:2501
0x5e1b83 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:17508
0x5e121b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:17544
0x5d6c47 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16732
0x5d6c47 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16613
0x5d6a85 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:15874
0x5d6ad5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:15860
0x5d61de tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16036
0x5d6ad5 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:15860
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions. 
cpp/src/arrow/compute/kernels/scalar_set_lookup.cc:70:50internal compiler errorin maybe_undo_parenthesized_ref, at cp/semantics.c:1740
auto on_found = [&](int32_t memo_index) { DCHECK_LT(memo_index, memo_size); };
0x683399 maybe_undo_parenthesized_ref(tree_node*)
../../gcc-7.5.0/gcc/cp/semantics.c:1739
0x6c8638 cp_fold
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2180
0x6c949c cp_fold_maybe_rvalue
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2042
0x6c8346 cp_fold
../../gcc-7.5.0/gcc/cp/cp-gimplify.c:2149
0x66a037 cp_convert_and_check(tree_node*, tree_node*, int)
../../gcc-7.5.0/gcc/cp/cvt.c:640
0x65f5d4 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, int)
../../gcc-7.5.0/gcc/cp/typeck.c:5208
0x5a689c build_new_op_1
../../gcc-7.5.0/gcc/cp/call.c:5978
0x5a737e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int)
../../gcc-7.5.0/gcc/cp/call.c:6022
0x657a12 build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int)
../../gcc-7.5.0/gcc/cp/typeck.c:3941
0x5e04ff tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:17001
0x5e1120 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16940
0x5e1120 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16940
0x5e1676 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:17312
0x5e121b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:17544
0x5d6c47 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16732
0x5d6c47 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16613
0x5d6a85 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:15874
0x5d696b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16090
0x5d696b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:16090
0x5d4aae tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-7.5.0/gcc/cp/pt.c:15845
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions. 

 

This is a known bug of gcc6/7. It is triggered when a const integer is capture by reference in a lambda function, and is parenthesized in that lambda code. See also:  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83204 and kokkos/kokkos-kernels#349

 

An easy fix is to capture levels and memo_size by value. {}Since they are ints, capturing by value is also a performace improvement{}. If there is no objection, I will submit a PR to fix this.

Environment: gcc6/7
c++14/17
Reporter: Jin Shang / @js8544
Assignee: Jin Shang / @js8544

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-17567. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Antoine Pitrou / @pitrou:
Issue resolved by pull request 14004
#14004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant