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

Build error on Windows (arm64) #240

Closed
Tracked by #44650
targos opened this issue Sep 15, 2022 · 11 comments
Closed
Tracked by #44650

Build error on Windows (arm64) #240

targos opened this issue Sep 15, 2022 · 11 comments

Comments

@targos
Copy link
Member

targos commented Sep 15, 2022

https://ci.nodejs.org/job/node-compile-windows/46957/nodes=win-vs2019-arm64/console

11:13:20   simd.cc
11:13:21 C:\workspace\node-compile-windows\node\deps\v8\src\objects\simd.cc(99,28): error C2078: too many initializers [C:\workspace\node-compile-windows\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]
11:13:21 C:\workspace\node-compile-windows\node\deps\v8\src\objects\simd.cc(109,1): error C2766: explicit specialization; 'int v8::internal::`anonymous-namespace'::extract_first_nonzero_index<uint32x4_t>(uint32x4_t)' has already been defined [C:\workspace\node-compile-windows\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]
@targos
Copy link
Member Author

targos commented Sep 16, 2022

The first error is considered "not a bug" by Microsoft. What should we do?

@nodejs/platform-windows-arm

https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911

@pbo-linaro
Copy link

It seems like a workaround was given by Microsoft (using .128_u8).
It it's working, would that be possible to simply add an ifdef for that compiler (vs gcc/clang)?

@niyas-sait
Copy link

We probably should upstream a patch to V8 as well to fix the same issue with MSVC.

@targos
Copy link
Member Author

targos commented Sep 16, 2022

Yes, please send a patch upstream if possible!

@pbo-linaro
Copy link

I'll look at it :)
If we integrate that in v8, can you easily update to latest version (including current trunk)?

@targos
Copy link
Member Author

targos commented Sep 16, 2022

Yes, the canary branch in this repository is updated automatically every day.

@pbo-linaro
Copy link

pbo-linaro commented Sep 20, 2022

@targos After investigation, it is indeed not a bug in msvc, but simply the C++ standard dictating this (and gcc having an extension that accepts it). The way to initialize those variables must be changed specifically for msvc.

In more, there is another problem appearing with a conflict between two template specialization.

Quick and dirty details and patch are available here: pbo-linaro/node@7586c64.

I'll try to upstream that in V8 directly (so nodejs and other projects can benefit from it).
If that's not ready for next nodejs release, you can still use that patch 👍

@pbo-linaro
Copy link

@targos I just submitted 4 patches to fix all compilation errors of V8 with MSVC (including some not concerning Node).

This one solves issue discussed here.

@targos
Copy link
Member Author

targos commented Sep 23, 2022

Amazing!

mikaws pushed a commit to mikaws/v8 that referenced this issue Sep 23, 2022
This compilation error was found by NodeJS when updating V8:
nodejs/node-v8#240

MSVC reports an error with "too many initializer" for type uint32x4_t.

---

Under gcc/clang, this is a typedef to a builtin type.

For MSVC, it is a typedef to this union:
typedef union __n128
{
     unsigned __int64   n128_u64[2];
     unsigned __int32   n128_u32[4];
     ...
} __n128;

C++ mandates that only first member of union can be initialized at
declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

VS people proposed to use designated initializer instead:
var = {.n128_u32={1, 2, 3, 8}}
https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
But, you need to use /std:c++20 for this, which is not the case in v8.

---

Thus, the only solution is to implement a hack specifically for MSVC,
where you build two uint64, from four uint32.

---------------------------------------

Once solved, another error is reported:
templated function extract_first_nonzero_index is specialized twice.

This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
same __n128 union. The fix is to drop templates, and use explicit
function names instead.

Bug: v8:13312
Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83404}
@pbo-linaro
Copy link

@targos Patches are now merged upstream, v8 canary should be able to compile for windows from now.

Don't hesitate to ping me if you need help in the future 👍

targos added a commit to targos/node that referenced this issue Sep 25, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
@targos
Copy link
Member Author

targos commented Sep 25, 2022

Cherry-picked all patches to nodejs/node#44741.

@targos targos closed this as completed Sep 25, 2022
targos added a commit to nodejs/node that referenced this issue Sep 25, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Sep 26, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Sep 27, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
targos added a commit to targos/node that referenced this issue Sep 28, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Sep 28, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
targos added a commit to targos/node that referenced this issue Sep 29, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Sep 29, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Sep 30, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 1, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 2, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 3, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
targos added a commit to targos/node that referenced this issue Oct 3, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
targos added a commit to nodejs/node that referenced this issue Oct 4, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 4, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 5, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 6, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 7, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 8, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 9, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
nodejs-github-bot pushed a commit that referenced this issue Oct 10, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    #240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
targos added a commit to targos/node that referenced this issue Oct 10, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
targos added a commit to nodejs/node that referenced this issue Oct 11, 2022
Original commit message:

    [msvc] fix build with neon intrinsics

    This compilation error was found by NodeJS when updating V8:
    nodejs/node-v8#240

    MSVC reports an error with "too many initializer" for type uint32x4_t.

    ---

    Under gcc/clang, this is a typedef to a builtin type.

    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;

    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.

    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.

    ---

    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.

    ---------------------------------------

    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.

    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.

    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}

Refs: v8/v8@1b3a4f0
PR-URL: #44741
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants