stdatomic.h broken on GCC-5.4.0 (error: request for member ‘__val’ in something not a structure or union)
Joakim Nohlgård
joakim.nohlgard@eistec.se
Wed Feb 22 17:32:00 GMT 2017
Dear developers,
The stdatomic.h header included with newlib gives compilation errors
with recent GCC versions.
GCC includes its own stdatomic.h, which works fine, but given that
there are preprocessor conditionals in newlib's stdatomic.h for GCC
makes me believe it has compiled OK at some point.
% printf '%s\n%s' '#include <stdint.h>' '#include <stdatomic.h>' | \
arm-none-eabi-gcc -nostdinc \
-isystem /usr/arm-none-eabi/include \
-isystem /usr/lib/gcc/arm-none-eabi/5.4.0/include \
-x c -o /dev/null -c -
In file included from <stdin>:2:0:
/usr/arm-none-eabi/include/stdatomic.h: In function
‘atomic_flag_test_and_set_explicit’:
/usr/arm-none-eabi/include/stdatomic.h:386:10: error: request for
member ‘__val’ in something not a structure or union
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
^
/usr/arm-none-eabi/include/stdatomic.h: In function
‘atomic_flag_clear_explicit’:
/usr/arm-none-eabi/include/stdatomic.h:393:2: error: request for
member ‘__val’ in something not a structure or union
atomic_store_explicit(&__object->__flag, 0, __order);
^
Building for i686-elf additionally gives errors about argument types:
% printf '%s\n%s' '#include <stdint.h>' '#include <stdatomic.h>' | \
i686-elf-gcc -nostdinc \
-isystem /usr/i686-elf/include \
-isystem /usr/lib/gcc/i686-elf/5.4.0/include \
-x c -o /dev/null -c -
/usr/i686-elf/include/stdatomic.h: In function
‘atomic_flag_test_and_set_explicit’:
/usr/i686-elf/include/stdatomic.h:386:10: error: request for member
‘__val’ in something not a structure or union
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
^
/usr/i686-elf/include/stdatomic.h:386:2: error: incompatible type for
argument 1 of ‘__atomic_exchange_n’
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
^
/usr/i686-elf/include/stdatomic.h: In function ‘atomic_flag_clear_explicit’:
/usr/i686-elf/include/stdatomic.h:393:2: error: request for member
‘__val’ in something not a structure or union
atomic_store_explicit(&__object->__flag, 0, __order);
^
/usr/i686-elf/include/stdatomic.h:393:2: error: incompatible type for
argument 1 of ‘__atomic_store_n’
atomic_store_explicit(&__object->__flag, 0, __order);
^
I have no idea on what would be a proper fix though.
Best regards,
Joakim Nohlgård
More information about the Newlib
mailing list