GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Make aarch64_output_simd_mov_imm_low return const char *

Changes the return type of aarch64_output_simd_mov_imm_low to const char * to avoid a -Werror=write-strings failure.

The function aarch64_output_simd_mov_imm_low in GCC’s AArch64 backend emits an instruction directly and returns an empty string. Since this empty string is a string literal, this commit changes the return type of the function to const char * from char *. This resolves a compilation error (-Werror=write-strings) that arises when the compiler prevents assigning a string literal to a non-const char *.

In Details

This commit corrects the return type of aarch64_output_simd_mov_imm_low in config/aarch64/aarch64.cc and config/aarch64/aarch64-protos.h from char * to const char *. The function emits an instruction and returns an empty string literal, which should be treated as a constant. This resolves a -Werror=write-strings error during compilation.

For Context

In C++, string literals are typically treated as constant character arrays. Assigning a string literal to a non-constant char * can lead to undefined behavior, which the -Werror=write-strings flag turns into a compilation error. By changing the return type to const char *, the compiler enforces that the returned string literal is not modified, preventing the error.

Filed Under: aarch64compilertype safety