diff --git a/src/modules/systemlib/param/param.h b/src/modules/systemlib/param/param.h index b29a7e51d6..8f53a5d730 100644 --- a/src/modules/systemlib/param/param.h +++ b/src/modules/systemlib/param/param.h @@ -374,6 +374,7 @@ union param_value_u { void *p; int32_t i; float f; + long long x; }; /** @@ -383,7 +384,23 @@ union param_value_u { * instead. */ struct param_info_s { - const char *name; + const char *name + +// GCC 4.8 and higher don't implement proper alignment of static data on +// 64-bit. This means that the 24-byte param_info_s variables are +// 16 byte aligned by GCC and that messes up the assumption that +// sequential items in the __param segment can be addressed as an array. +// The assumption is that the address of the second parameter is at +// ¶m[0]+sizeof(param[0]). When compiled with clang it is +// true, with gcc is is not true. +// See https://llvm.org/bugs/show_bug.cgi?format=multiple&id=18006 +// The following hack is for GCC >=4.8 only. Clang works fine without +// this. +#ifdef __PX4_LINUX + __attribute__((aligned(16))); +#else + ; +#endif param_type_t type; union param_value_u val; };