nodejs / node-v8

Experimental Node.js mirror on V8 lkgr :sparkles::turtle::rocket::sparkles:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler error with latest canary

targos opened this issue · comments

https://github.com/nodejs/node-v8/actions/runs/7271603973/job/19812421974

In file included from /usr/include/unistd.h:226,
                 from ../deps/v8/third_party/abseil-cpp/absl/base/internal/thread_identity.h:27,
                 from ../deps/v8/third_party/abseil-cpp/absl/synchronization/mutex.h:71,
                 from ../deps/v8/third_party/abseil-cpp/absl/strings/internal/cordz_info.h:31,
                 from ../deps/v8/third_party/abseil-cpp/absl/strings/cord.h:91,
                 from ../deps/v8/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h:56,
                 from ../deps/v8/third_party/abseil-cpp/absl/container/flat_hash_map.h:41,
                 from ../deps/v8/src/zone/zone-containers.h:20,
                 from ../deps/v8/src/compiler/code-assembler.h:30,
                 from ../deps/v8/src/codegen/code-stub-assembler.h:15,
                 from ../deps/v8/src/builtins/builtins-iterator-gen.h:8,
                 from ../deps/v8/src/builtins/builtins-intl-gen.cc:9:
../deps/v8/src/builtins/builtins-intl-gen.cc: In member function ‘v8::internal::TNode<v8::internal::Uint8T> v8::internal::IntlBuiltinsAssembler::GetChar(v8::internal::TNode<v8::internal::SeqOneByteString>, int)’:
../deps/v8/src/builtins/builtins-intl-gen.cc:43:43: error: ‘index’ is not a constant expression
   43 |         offsetof(SeqOneByteString, chars_[index]) - kHeapObjectTag;
      |                                           ^~~~~
make[1]: *** [tools/v8_gypfiles/v8_initializers.target.mk:468: /home/runner/work/node-v8/node-v8/node-v8/out/Release/obj.target/v8_initializers/deps/v8/src/builtins/builtins-intl-gen.o] Error 1

Here's a test on my fork to see if the GCC version makes a difference: https://github.com/targos/node-v8/actions/runs/7275899259

Well, they all failed with the same error! Now I suspect it might be change that requires C++20 support.

Same error with C++20 😞

/cc @LeszekSwirski this seems to have been introduced by https://chromium-review.googlesource.com/c/v8/v8/+/5077926. Maybe you have an idea for why the V8 GCC buildbot didn't fail with that error?

Interesting, looks like this was a change made in gcc 11 (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95942) -- there seems to be some disagreement/lack of clarity in the C/C++ specs on whether an array member element access is a "member designator" or not, and looks like other compilers (and gcc up to 10) relaxed the spec requirement that the result is an integral constant. The V8 GCC buildbot runs with gcc 9, so it won't have picked this up.

I guess we have to rewrite this the old fashioned way -- shame, the offsetof with runtime index is much neater.

Thank you!

That fix landed, can you try patching it in and trying again?

Build passed!