Skip to content

-O2 gcc flag breaks armhf build #8501

@Raimo33

Description

@Raimo33

When compiling for an arm 32bit (armhf) target, ./configure yields this error:

checking for unaligned access to int... ccan/tools/configurator/configurator: Test for HAVE_UNALIGNED_ACCESS did not compile:
configuratortest.c: In function 'main':
configuratortest.c:8:22: error: array subscript 'int[0]' is partly outside array bounds of 'char[4]' [-Werror=array-bounds]
     8 |         return *x == *y;
        |                      ^~
configuratortest.c:5:11: note: at offset 1 into object 'pad' of size 4
     5 |      char pad[sizeof(int *) * 1];
        |           ^~~
cc1: all warnings being treated as errors 

This only happens when using the -O2 flag and above. -O1 compiles fine.

to reproduce, you can use a cross compiler (GCC) and these flags: "-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions