qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1895471] [NEW] compilation error with clang in util/async.c
@ 2020-09-13 18:56 Amey Narkhede
  2020-09-14  9:49 ` Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Amey Narkhede @ 2020-09-13 18:56 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

configured with ` CC=clang CXX=clang++ ../configure --target-
list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug --enable-
jemalloc --enable-fuzzing --enable-sdl` and after make I get the
following error related to c11 atomics. I'm using clang because I'm
experimenting with fuzzer

[glitz@archlinux /code/qemu/build]$ ninja -j5
[479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
FAILED: libqemuutil.a.p/util_async.c.o
clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
    old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                ^               ~~~~~~~~~~
/usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
    *flags = atomic_fetch_and(&bh->flags,
             ^                ~~~~~~~~~~
/usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
#define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                          ^                      ~~~~~~
2 errors generated.
[483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
ninja: build stopped: subcommand failed.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895471

Title:
  compilation error with clang in util/async.c

Status in QEMU:
  New

Bug description:
  configured with ` CC=clang CXX=clang++ ../configure --target-
  list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug
  --enable-jemalloc --enable-fuzzing --enable-sdl` and after make I get
  the following error related to c11 atomics. I'm using clang because
  I'm experimenting with fuzzer

  [glitz@archlinux /code/qemu/build]$ ninja -j5
  [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
  FAILED: libqemuutil.a.p/util_async.c.o
  clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
  ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                  ^               ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
  #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                           ^                     ~~~~~~
  ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      *flags = atomic_fetch_and(&bh->flags,
               ^                ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
  #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                            ^                      ~~~~~~
  2 errors generated.
  [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895471/+subscriptions


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

* Re: [Bug 1895471] [NEW] compilation error with clang in util/async.c
  2020-09-13 18:56 [Bug 1895471] [NEW] compilation error with clang in util/async.c Amey Narkhede
@ 2020-09-14  9:49 ` Stefan Hajnoczi
  2020-09-14  9:49   ` Stefan Hajnoczi
  2020-09-14 10:52 ` [Bug 1895471] " Amey Narkhede
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-09-14  9:49 UTC (permalink / raw)
  To: Bug 1895471; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3274 bytes --]

On Sun, Sep 13, 2020 at 06:56:12PM -0000, Amey Narkhede wrote:
> configured with ` CC=clang CXX=clang++ ../configure --target-
> list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug --enable-
> jemalloc --enable-fuzzing --enable-sdl` and after make I get the
> following error related to c11 atomics. I'm using clang because I'm
> experimenting with fuzzer
> 
> [glitz@archlinux /code/qemu/build]$ ninja -j5
> [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
> FAILED: libqemuutil.a.p/util_async.c.o
> clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
> ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
>     old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
>                 ^               ~~~~~~~~~~
> /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
> #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
>                                          ^                     ~~~~~~
> ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
>     *flags = atomic_fetch_and(&bh->flags,
>              ^                ~~~~~~~~~~
> /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
> #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
>                                           ^                      ~~~~~~
> 2 errors generated.
> [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
> ninja: build stopped: subcommand failed.

This happens when a system header file includes <stdatomic.h>. QEMU's
"atomic.h" conflicts with <stdatomic.h> in that QEMU atomic variables do
not need to be declared _Atomic.

Please rerun the full clang command-line above from your meson build
directory with -E instead of -c. Then upload the
libqemuutil.a.p/util_async.c.o so we can see why stdatomic.h was
included.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Bug 1895471] [NEW] compilation error with clang in util/async.c
  2020-09-14  9:49 ` Stefan Hajnoczi
@ 2020-09-14  9:49   ` Stefan Hajnoczi
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-09-14  9:49 UTC (permalink / raw)
  To: qemu-devel

On Sun, Sep 13, 2020 at 06:56:12PM -0000, Amey Narkhede wrote:
> configured with ` CC=clang CXX=clang++ ../configure --target-
> list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug --enable-
> jemalloc --enable-fuzzing --enable-sdl` and after make I get the
> following error related to c11 atomics. I'm using clang because I'm
> experimenting with fuzzer
> 
> [glitz@archlinux /code/qemu/build]$ ninja -j5
> [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
> FAILED: libqemuutil.a.p/util_async.c.o
> clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
> ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
>     old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
>                 ^               ~~~~~~~~~~
> /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
> #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
>                                          ^                     ~~~~~~
> ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
>     *flags = atomic_fetch_and(&bh->flags,
>              ^                ~~~~~~~~~~
> /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
> #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
>                                           ^                      ~~~~~~
> 2 errors generated.
> [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
> ninja: build stopped: subcommand failed.

This happens when a system header file includes <stdatomic.h>. QEMU's
"atomic.h" conflicts with <stdatomic.h> in that QEMU atomic variables do
not need to be declared _Atomic.

Please rerun the full clang command-line above from your meson build
directory with -E instead of -c. Then upload the
libqemuutil.a.p/util_async.c.o so we can see why stdatomic.h was
included.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895471

Title:
  compilation error with clang in util/async.c

Status in QEMU:
  New

Bug description:
  configured with ` CC=clang CXX=clang++ ../configure --target-
  list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug
  --enable-jemalloc --enable-fuzzing --enable-sdl` and after make I get
  the following error related to c11 atomics. I'm using clang because
  I'm experimenting with fuzzer

  [glitz@archlinux /code/qemu/build]$ ninja -j5
  [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
  FAILED: libqemuutil.a.p/util_async.c.o
  clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
  ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                  ^               ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
  #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                           ^                     ~~~~~~
  ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      *flags = atomic_fetch_and(&bh->flags,
               ^                ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
  #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                            ^                      ~~~~~~
  2 errors generated.
  [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895471/+subscriptions


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

* [Bug 1895471] Re: compilation error with clang in util/async.c
  2020-09-13 18:56 [Bug 1895471] [NEW] compilation error with clang in util/async.c Amey Narkhede
  2020-09-14  9:49 ` Stefan Hajnoczi
@ 2020-09-14 10:52 ` Amey Narkhede
  2020-09-16 11:33   ` Stefan Hajnoczi
  2020-09-21 12:59 ` Stefan Hajnoczi
  2021-05-09 14:05 ` Thomas Huth
  3 siblings, 1 reply; 8+ messages in thread
From: Amey Narkhede @ 2020-09-14 10:52 UTC (permalink / raw)
  To: qemu-devel

Ok. So I attached the util_async.o file below

** Attachment added: "util_async.c.o"
   https://bugs.launchpad.net/qemu/+bug/1895471/+attachment/5410694/+files/util_async.c.o

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895471

Title:
  compilation error with clang in util/async.c

Status in QEMU:
  New

Bug description:
  configured with ` CC=clang CXX=clang++ ../configure --target-
  list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug
  --enable-jemalloc --enable-fuzzing --enable-sdl` and after make I get
  the following error related to c11 atomics. I'm using clang because
  I'm experimenting with fuzzer

  [glitz@archlinux /code/qemu/build]$ ninja -j5
  [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
  FAILED: libqemuutil.a.p/util_async.c.o
  clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
  ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                  ^               ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
  #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                           ^                     ~~~~~~
  ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      *flags = atomic_fetch_and(&bh->flags,
               ^                ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
  #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                            ^                      ~~~~~~
  2 errors generated.
  [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895471/+subscriptions


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

* Re: [Bug 1895471] Re: compilation error with clang in util/async.c
  2020-09-14 10:52 ` [Bug 1895471] " Amey Narkhede
@ 2020-09-16 11:33   ` Stefan Hajnoczi
  2020-09-16 11:33     ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-09-16 11:33 UTC (permalink / raw)
  To: Bug 1895471; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

On Mon, Sep 14, 2020 at 10:52:16AM -0000, Amey Narkhede wrote:
> Ok. So I attached the util_async.o file below

It looks like you can work around this issue with ./configure --disable-linux-io-uring.

I'll investigate what can be done to solve the interference between
<stdatomic.h> and QEMU's "atomic.h" next week.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Bug 1895471] Re: compilation error with clang in util/async.c
  2020-09-16 11:33   ` Stefan Hajnoczi
@ 2020-09-16 11:33     ` Stefan Hajnoczi
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-09-16 11:33 UTC (permalink / raw)
  To: qemu-devel

On Mon, Sep 14, 2020 at 10:52:16AM -0000, Amey Narkhede wrote:
> Ok. So I attached the util_async.o file below

It looks like you can work around this issue with ./configure --disable-
linux-io-uring.

I'll investigate what can be done to solve the interference between
<stdatomic.h> and QEMU's "atomic.h" next week.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895471

Title:
  compilation error with clang in util/async.c

Status in QEMU:
  New

Bug description:
  configured with ` CC=clang CXX=clang++ ../configure --target-
  list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug
  --enable-jemalloc --enable-fuzzing --enable-sdl` and after make I get
  the following error related to c11 atomics. I'm using clang because
  I'm experimenting with fuzzer

  [glitz@archlinux /code/qemu/build]$ ninja -j5
  [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
  FAILED: libqemuutil.a.p/util_async.c.o
  clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
  ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                  ^               ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
  #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                           ^                     ~~~~~~
  ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      *flags = atomic_fetch_and(&bh->flags,
               ^                ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
  #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                            ^                      ~~~~~~
  2 errors generated.
  [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895471/+subscriptions


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

* [Bug 1895471] Re: compilation error with clang in util/async.c
  2020-09-13 18:56 [Bug 1895471] [NEW] compilation error with clang in util/async.c Amey Narkhede
  2020-09-14  9:49 ` Stefan Hajnoczi
  2020-09-14 10:52 ` [Bug 1895471] " Amey Narkhede
@ 2020-09-21 12:59 ` Stefan Hajnoczi
  2021-05-09 14:05 ` Thomas Huth
  3 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-09-21 12:59 UTC (permalink / raw)
  To: qemu-devel

Mailing list discussion about how to fix this:
https://lists.gnu.org/archive/html/qemu-devel/2020-09/msg07392.html

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895471

Title:
  compilation error with clang in util/async.c

Status in QEMU:
  New

Bug description:
  configured with ` CC=clang CXX=clang++ ../configure --target-
  list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug
  --enable-jemalloc --enable-fuzzing --enable-sdl` and after make I get
  the following error related to c11 atomics. I'm using clang because
  I'm experimenting with fuzzer

  [glitz@archlinux /code/qemu/build]$ ninja -j5
  [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
  FAILED: libqemuutil.a.p/util_async.c.o
  clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
  ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                  ^               ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
  #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                           ^                     ~~~~~~
  ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      *flags = atomic_fetch_and(&bh->flags,
               ^                ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
  #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                            ^                      ~~~~~~
  2 errors generated.
  [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895471/+subscriptions


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

* [Bug 1895471] Re: compilation error with clang in util/async.c
  2020-09-13 18:56 [Bug 1895471] [NEW] compilation error with clang in util/async.c Amey Narkhede
                   ` (2 preceding siblings ...)
  2020-09-21 12:59 ` Stefan Hajnoczi
@ 2021-05-09 14:05 ` Thomas Huth
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2021-05-09 14:05 UTC (permalink / raw)
  To: qemu-devel

I think this has been fixed here:
https://gitlab.com/qemu-project/qemu/-/commit/d73415a315471a
... so I'm closing this now. If you still have problems, please open a new ticket in our new issue tracker here: https://gitlab.com/qemu-project/qemu/-/issues

** Changed in: qemu
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895471

Title:
  compilation error with clang in util/async.c

Status in QEMU:
  Fix Released

Bug description:
  configured with ` CC=clang CXX=clang++ ../configure --target-
  list=x86_64-softmmu --enable-kvm --enable-curl --enable-debug
  --enable-jemalloc --enable-fuzzing --enable-sdl` and after make I get
  the following error related to c11 atomics. I'm using clang because
  I'm experimenting with fuzzer

  [glitz@archlinux /code/qemu/build]$ ninja -j5
  [479/2290] Compiling C object libqemuutil.a.p/util_async.c.o
  FAILED: libqemuutil.a.p/util_async.c.o
  clang -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -Ilinux-headers -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -g -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -fstack-protector-strong -fsanitize=fuzzer-no-link -iquote /code/qemu/tcg/i386 -isystem /code/qemu/linux-headers -iquote . -iquote /code/qemu -iquote /code/qemu/accel/tcg -iquote /code/qemu/include -iquote /code/qemu/disas/libvixl -pthread -fPIC -MD -MQ libqemuutil.a.p/util_async.c.o -MF libqemuutil.a.p/util_async.c.o.d -o libqemuutil.a.p/util_async.c.o -c ../util/async.c
  ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      old_flags = atomic_fetch_or(&bh->flags, BH_PENDING | new_flags);
                  ^               ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:138:42: note: expanded from macro 'atomic_fetch_or'
  #define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                           ^                     ~~~~~~
  ../util/async.c:105:14: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      *flags = atomic_fetch_and(&bh->flags,
               ^                ~~~~~~~~~~
  /usr/lib/clang/10.0.1/include/stdatomic.h:144:43: note: expanded from macro 'atomic_fetch_and'
  #define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
                                            ^                      ~~~~~~
  2 errors generated.
  [483/2290] Compiling C object libqemuutil.a.p/util_qemu-error.c.o
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895471/+subscriptions


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

end of thread, other threads:[~2021-05-09 14:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13 18:56 [Bug 1895471] [NEW] compilation error with clang in util/async.c Amey Narkhede
2020-09-14  9:49 ` Stefan Hajnoczi
2020-09-14  9:49   ` Stefan Hajnoczi
2020-09-14 10:52 ` [Bug 1895471] " Amey Narkhede
2020-09-16 11:33   ` Stefan Hajnoczi
2020-09-16 11:33     ` Stefan Hajnoczi
2020-09-21 12:59 ` Stefan Hajnoczi
2021-05-09 14:05 ` Thomas Huth

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 NNTP newsgroup(s).