Open
Description
The Clang compiler, LLVM reports error "fatal error: error in backend: Invalid size request on a scalable vector." starting from version 17.0.1 with the following compiler options:
-march=armv9-a
and higher (armv9.1-a, armv9.2-a, armv9.3-a and so on) and -mstrict-align
and optimization flags like -Os
, -O2
Notes when it works successfully:
- When Optimization flag:
-O0
,-O1
,-O3
, example https://gcc.godbolt.org/z/4ojzoz9jP - Without
-mstrict-align
flag, example https://gcc.godbolt.org/z/7MbqGfoe8 - Without any optimization flags and specified
-mstrict-align
with-march=armv9-a
, example https://gcc.godbolt.org/z/e7q1bv498 - When target architecture from
armv8-a
toarmv8.9-a
, example https://gcc.godbolt.org/z/q6eobPPPx - When loop iteration count not power of 2, for example,
array_size
is127
- https://gcc.godbolt.org/z/d7rKvdboG
armv8-a clang (trunk) - Failed
armv8-a clang 18.1.0 - Failed
armv8-a clang 17.0.1 - Failed
armv8-a clang 16.0.0 - No problem
Steps to reproduce the issue.
#include<stdint.h>#include<stdlib.h>uint64_t*InvalidSizeRequestOnScalableVector() { uint64_tvalue=30; uint64_tarray_size=128; uint64_t*array= (uint64_t*) malloc(sizeof(uint64_t) *array_size); for (unsigned longi=0; i<array_size; i++) { array[i] =value; } returnarray; }