Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-17567

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 9.0.0
    • 10.0.0
    • C++
    • gcc6/7
      c++14/17

    Description

      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:24: internal compiler error: in 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:50: internal compiler error: in 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 https://github.com/kokkos/kokkos-kernels/issues/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.

      Attachments

        Issue Links

          Activity

            People

              jinshang Jin Shang
              jinshang Jin Shang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m