Skip to content

[Bug]: clang-18 / NDK 27 Compilation hangs / Runs out of memory when using SIMD __ext_vector_type__(3) short #2181

@fil-spatial

Description

@fil-spatial

Description

With any clang-18 version shipped with any of the NDK 27.* publicly versions the following SIMD code hangs indefinitely.

More specifically:
With any NDK 27 version and:

  • target armv8
  • SIMD vector of size 3
  • SIMD vector of type short
  • compilation not optimised (-O0)

the following SIMD code hangs indefinitely and possibly runs out of memory (exit 137)

typedef __attribute__((__ext_vector_type__(3))) short vector_short3;

void func()
{
    vector_short3 result;
    result.x = short(1);
}

This can be also verified in godbolt here: https://godbolt.org/z/48fdKoEon

Note: it is enough to change any of the pre-condition above to have the compilation to complete successfully.
So to say it is very a nit (yet annoying) case.

Assuming a strict requirements for NDK27, it would be great if you could recommend the workaround with the best tradeoff between the followings - or recommend better.

  • just use normal vector/struct of short for 3 dimensional vectors
  • just use int instead of short for the vector
  • Compile all objs relying on this type with at least -O1 also for debug builds

Upstream bug

llvm/llvm-project#156836

Commit to cherry-pick

No response

I am using a supported NDK

  • I have checked and the NDK I'm using is currently supported

Affected versions

r27

Host OS

Mac, Linux

Host OS version

All versions

Affected ABIs

arm64-v8a

Metadata

Metadata

Labels

Type

No type

Projects

Status

Awaiting fix

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions