Skip to content

[compiler-rt][AArch64] The test case compiler-rt/test/builtins/Unit/atomic_test.c segfaults randomly on __atomic_load_c() #113371

Open
@pawosm-arm

Description

@pawosm-arm

__atomic_load_c() is defined as such:

void __atomic_load_c(int size, void *src, void *dest,
                     int model) EXTERNAL_NAME(__atomic_load);

and is called as such:

__atomic_load_c(n, data + 1, dst + 1, model);

...where data is const as such:

__attribute__((aligned(16))) static const char data[] = {

In effect, this piece of code not only spits warning about const when compiled, but also segfaults.

With the following change it stops to segfault:

--- a/compiler-rt/test/builtins/Unit/atomic_test.c
+++ b/compiler-rt/test/builtins/Unit/atomic_test.c
@@ -144,7 +144,7 @@ typedef uint64_t maxuint_t;

 #define LEN(array) (sizeof(array) / sizeof(array[0]))

-__attribute__((aligned(16))) static const char data[] = {
+__attribute__((aligned(16))) static char data[] = {
     0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
     0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions