public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* stdatomic.h broken on GCC-5.4.0 (error: request for member ‘__val’ in something not a structure or union)
@ 2017-02-22 17:32 Joakim Nohlgård
  2017-02-23  7:13 ` Sebastian Huber
  0 siblings, 1 reply; 4+ messages in thread
From: Joakim Nohlgård @ 2017-02-22 17:32 UTC (permalink / raw)
  To: newlib

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-23 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 17:32 stdatomic.h broken on GCC-5.4.0 (error: request for member ‘__val’ in something not a structure or union) Joakim Nohlgård
2017-02-23  7:13 ` Sebastian Huber
2017-02-23 10:17   ` Corinna Vinschen
2017-02-23 10:19     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).