include/qemu/atomic.h:495:5: error: misaligned atomic operation may incur significant performance penalty (Clang 11; Ubuntu 16 i686)

Bug #1904259 reported by Ivan Serdyuk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Expired
Undecided
Unassigned
Ubuntu
Expired
Undecided
Unassigned

Bug Description

Hello.
I haven't found any "official" executables, for emulating RISC-V (32bit; 64bit) so I had to compile those myself.

I found that auto-generated build scripts, for Ninja, contained some warnings interpreted as errors:

oceanfish81@gollvm:~/Desktop/qemu/build$ ninja -j 1
[2/1977] Compiling C object libqemuutil.a.p/util_qsp.c.o
FAILED: libqemuutil.a.p/util_qsp.c.o
clang-11 -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -O2 -g -m32 -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 -Wno-psabi -fstack-protector-strong -isystem /home/oceanfish81/Desktop/qemu/linux-headers -isystem linux-headers -iquote /home/oceanfish81/Desktop/qemu/tcg/i386 -iquote . -iquote /home/oceanfish81/Desktop/qemu -iquote /home/oceanfish81/Desktop/qemu/accel/tcg -iquote /home/oceanfish81/Desktop/qemu/include -iquote /home/oceanfish81/Desktop/qemu/disas/libvixl -pthread -Wno-unused-function -fPIC -MD -MQ libqemuutil.a.p/util_qsp.c.o -MF libqemuutil.a.p/util_qsp.c.o.d -o libqemuutil.a.p/util_qsp.c.o -c ../util/qsp.c
In file included from ../util/qsp.c:62:
In file included from /home/oceanfish81/Desktop/qemu/include/qemu/thread.h:4:
In file included from /home/oceanfish81/Desktop/qemu/include/qemu/processor.h:10:
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:495:5: error: misaligned atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment]
    qatomic_set__nocheck(ptr, val);
    ^
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:138:5: note: expanded from macro 'qatomic_set__nocheck'
    __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
    ^
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:485:12: error: misaligned atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment]
    return qatomic_read__nocheck(ptr);
           ^
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:129:5: note: expanded from macro 'qatomic_read__nocheck'
    __atomic_load_n(ptr, __ATOMIC_RELAXED)
    ^
2 errors generated.
ninja: build stopped: subcommand failed.

Revision history for this message
Ivan Serdyuk (oceanfish81) wrote :
Revision history for this message
Ivan Serdyuk (oceanfish81) wrote :

$ python3.7 ../meson/meson.py --version
0.55.3

$ clang-11 --version
Ubuntu clang version 11.0.0-++20200721055954+cebd637c886-1~exp1~20200721161335.13
Target: i686-pc-linux-gnu
Thread model: posix

$ ninja --version
1.10.0.git.kitware.jobserver-1

$ uname -a
Linux laptop 4.15.0-123-generic #126~16.04.1-Ubuntu SMP Wed Oct 21 13:51:51 UTC 2020 i686 i686 i686 GNU/Linux

Revision history for this message
Ivan Serdyuk (oceanfish81) wrote :

Solved by removing -Werror flag

Revision history for this message
Thomas Huth (th-huth) wrote :

Do you still get the warning with the latest version of QEMU (v6.0)?

Changed in qemu:
status: New → Incomplete
Changed in ubuntu:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for QEMU because there has been no activity for 60 days.]

Changed in qemu:
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Ubuntu because there has been no activity for 60 days.]

Changed in ubuntu:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.