tests/tcg: Suppress compiler false-positive warning on sha1.c
PATCH 1/1 tests/tcg: Suppress compiler false-positive warning on sha1.c
GCC versions at least 12 through 15 incorrectly report a warning about code in sha1.c:
tests/tcg/multiarch/sha1.c:161:13: warning: ‘SHA1Transform’ reading 64 bytes from a region of size 0 [-Wstringop-overread]
161 | SHA1Transform(context->state, &data[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is a piece of stock library code for doing SHA1 which we've simply copied, rather than writing ourselves. The bug has been reported to upstream GCC (about a different library's use of this code):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709
For our test case, since this isn't our original code and there isn't actually a bug in it, suppress the incorrect warning rather than trying to modify the code to work around the compiler issue.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2328
--- tests/tcg/aarch64/Makefile.target | 3 ++- tests/tcg/arm/Makefile.target | 3 ++- tests/tcg/multiarch/Makefile.target | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-)
tests/tcg/aarch64/Makefile.target +2 -1
@@ -83,7 +83,8 @@ test-aes: CFLAGS += -O -march=armv8-a+aes test-aes: test-aes-main.c.inc # Vector SHA1 -sha1-vector: CFLAGS=-O3 +# Work around compiler false-positive warning, as we do for the 'sha1' test +sha1-vector: CFLAGS=-O3 -Wno-stringop-overread sha1-vector: sha1.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) run-sha1-vector: sha1-vector run-sha1
tests/tcg/arm/Makefile.target +2 -1
@@ -61,7 +61,8 @@ endif ARM_TESTS += commpage # Vector SHA1 -sha1-vector: CFLAGS=-O3 +# Work around compiler false-positive warning, as we do for the 'sha1' test +sha1-vector: CFLAGS=-O3 -Wno-stringop-overread sha1-vector: sha1.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) run-sha1-vector: sha1-vector run-sha1
tests/tcg/multiarch/Makefile.target +8 -0
@@ -45,6 +45,14 @@ vma-pthread: LDFLAGS+=-pthread sigreturn-sigmask: CFLAGS+=-pthread sigreturn-sigmask: LDFLAGS+=-pthread +# GCC versions 12/13/14/15 at least incorrectly complain about +# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 +# Since this is just a standard piece of library code we've borrowed for a +# TCG test case, suppress the warning rather than trying to modify the +# code to work around the compiler. +sha1: CFLAGS+=-Wno-stringop-overread + # The vma-pthread seems very sensitive on gitlab and we currently # don't know if its exposing a real bug or the test is flaky. ifneq ($(GITLAB_CI),)
Signature · 1 line
2.43.0
Quoted 17 lines · Peter Maydell
GCC versions at least 12 through 15 incorrectly report a warning about code in
sha1.c:
tests/tcg/multiarch/sha1.c:161:13: warning: ‘SHA1Transform’ reading 64 bytes from a region of size 0 [-Wstringop-overread]161 | SHA1Transform(context->state, &data[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is a piece of stock library code for doing SHA1 which we've simply copied, rather than writing ourselves. The bug has been reported to upstream GCC (about a different library's use of this code):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709For our test case, since this isn't our original code and there isn't actually a bug in it, suppress the incorrect warning rather than trying to modify the code to work around the compiler issue.
Quoted 7 lines
Resolves:https://gitlab.com/qemu-project/qemu/-/issues/2328
Signed-off-by Peter Maydell<[email protected]>--- tests/tcg/aarch64/Makefile.target | 3 ++- tests/tcg/arm/Makefile.target | 3 ++- tests/tcg/multiarch/Makefile.target | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-)
r~
Alex Bennée
AppliedQuoted 13 lines · Peter Maydell
GCC versions at least 12 through 15 incorrectly report a warning about code in
sha1.c:
tests/tcg/multiarch/sha1.c:161:13: warning: ‘SHA1Transform’ reading 64 bytes from a region of size 0 [-Wstringop-overread]161 | SHA1Transform(context->state, &data[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is a piece of stock library code for doing SHA1 which we've simply copied, rather than writing ourselves. The bug has been reported to upstream GCC (about a different library's use of this code):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709
Quoted 3 lines
For our test case, since this isn't our original code and there isn't actually a bug in it, suppress the incorrect warning rather than trying to modify the code to work around the compiler issue.
Queued to maintainer/for-10.0-softfreeze, thanks.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 16 lines · Peter Maydell
GCC versions at least 12 through 15 incorrectly report a warning about code in
sha1.c:
tests/tcg/multiarch/sha1.c:161:13: warning: ‘SHA1Transform’ reading 64 bytes from a region of size 0 [-Wstringop-overread]161 | SHA1Transform(context->state, &data[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is a piece of stock library code for doing SHA1 which we've simply copied, rather than writing ourselves. The bug has been reported to upstream GCC (about a different library's use of this code):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709For our test case, since this isn't our original code and there isn't actually a bug in it, suppress the incorrect warning rather than trying to modify the code to work around the compiler issue.
<snip>
Quoted 4 lines
tests/tcg/multiarch/Makefile.target +0
-0@@ -45,6 +45,14 @@ vma-pthread: LDFLAGS+=-pthread sigreturn-sigmask: CFLAGS+=-pthread
tests/tcg/multiarch/Makefile.target vma-pthread: LDFLAGS+=-pthread · line 55
Quoted 10 lines
tests/tcg/multiarch/Makefile.target +8
-0sigreturn-sigmask: LDFLAGS+=-pthread +# GCC versions 12/13/14/15 at least incorrectly complain about +# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 +# Since this is just a standard piece of library code we've borrowed for a +# TCG test case, suppress the warning rather than trying to modify the +# code to work around the compiler. +sha1: CFLAGS+=-Wno-stringop-overread +
Sadly this breaks the hexagon compiler:
error: unknown warning option '-Wno-stringop-overread' [-Werror,-Wunknown-warning-option]
Traceback (most recent call last):
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 683, in <module>
sys.exit(main())
^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 679, in main
return args.cmdobj.run(args, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 657, in run
return Docker().run(cmd, False, quiet=args.quiet,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 370, in run
ret = self._do_check(["run", "--rm", "--label",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 247, in _do_check
return subprocess.check_call(self._command + cmd, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea', '--userns=keep-id', '-u', '1000', '-w', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user', '-v', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:rw', '-v', '/home/alex/lsrc/qemu.git:/home/alex/lsrc/qemu.git:ro,z', 'qemu/debian-hexagon-cross', 'hexagon-unknown-linux-musl-clang', '-Wno-incompatible-pointer-types', '-Wno-undefined-internal', '-fno-unroll-loops', '-fno-stack-protector', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-Wno-stringop-overread', '-mv73', '-O2', '-static', '/home/alex/lsrc/qemu.git/tests/tcg/multiarch/sha1.c', '-o', 'sha1', '-static']' returned non-zero exit status 1. filter=--filter=label=com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea
make[1]: *** [Makefile:122: sha1] Error 1
make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:52: build-tcg-tests-hexagon-linux-user] Error 2
Is it that new an option?
Quoted 3 lines
tests/tcg/multiarch/Makefile.target +0
-0# The vma-pthread seems very sensitive on gitlab and we currently # don't know if its exposing a real bug or the test is flaky. ifneq ($(GITLAB_CI),)
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 37 lines · Alex Bennée
tests/tcg/multiarch/Makefile.target vma-pthread: LDFLAGS+=-pthread · line 55
Quoted 8 lines · Peter Maydell
tests/tcg/multiarch/Makefile.target +8
-0+# GCC versions 12/13/14/15 at least incorrectly complain about +# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 +# Since this is just a standard piece of library code we've borrowed for a +# TCG test case, suppress the warning rather than trying to modify the +# code to work around the compiler. +sha1: CFLAGS+=-Wno-stringop-overread +Sadly this breaks the hexagon compiler:
error: unknown warning option '-Wno-stringop-overread' [-Werror,-Wunknown-warning-option]
Traceback (most recent call last):
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 683, in <module>
sys.exit(main())
^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 679, in main
returnargs.cmdobj.run(args, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 657, in run
return Docker().run(cmd, False, quiet=args.quiet,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 370, in run
ret = self._do_check(["run", "--rm", "--label",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 247, in_do_check
returnsubprocess.check_call(self._command + cmd, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 413, incheck_call
raiseCalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea', '--userns=keep-id', '-u', '1000', '-w', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user', '-v', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:rw', '-v', '/home/alex/lsrc/qemu.git:/home/alex/lsrc/qemu.git:ro,z', 'qemu/debian-hexagon-cross', 'hexagon-unknown-linux-musl-clang', '-Wno-incompatible-pointer-types', '-Wno-undefined-internal', '-fno-unroll-loops', '-fno-stack-protector', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-Wno-stringop-overread', '-mv73', '-O2', '-static', '/home/alex/lsrc/qemu.git/tests/tcg/multiarch/sha1.c', '-o', 'sha1', '-static']' returned non-zero exit status 1. filter=--filter=label=com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea
make[1]: *** [Makefile:122: sha1] Error 1
make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:52: build-tcg-tests-hexagon-linux-user] Error 2
Quoted 1 line
Is it that new an option?
I think it's new-ish (gcc 11?). On the other hand -Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overread
does that work?
(Meson has cc.get_supported_arguments() that we can use to filter out -Wfoo/-Wno-foo options that the compiler doesn't support, but since this is built via a makefile rather than by meson that's not conveniently accessible.)
-- PMM
Quoted 38 lines · Peter Maydell
Quoted 37 lines · Alex Bennée
tests/tcg/multiarch/Makefile.target vma-pthread: LDFLAGS+=-pthread · line 55
Quoted 8 lines · Peter Maydell
tests/tcg/multiarch/Makefile.target +8
-0+# GCC versions 12/13/14/15 at least incorrectly complain about +# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 +# Since this is just a standard piece of library code we've borrowed for a +# TCG test case, suppress the warning rather than trying to modify the +# code to work around the compiler. +sha1: CFLAGS+=-Wno-stringop-overread +Sadly this breaks the hexagon compiler:
error: unknown warning option '-Wno-stringop-overread' [-Werror,-Wunknown-warning-option]
Traceback (most recent call last):
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 683, in <module>
sys.exit(main())
^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 679, in main
returnargs.cmdobj.run(args, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 657, in run
return Docker().run(cmd, False, quiet=args.quiet,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 370, in run
ret = self._do_check(["run", "--rm", "--label",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 247, in_do_check
returnsubprocess.check_call(self._command + cmd, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 413, incheck_call
raiseCalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea', '--userns=keep-id', '-u', '1000', '-w', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user', '-v', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:rw', '-v', '/home/alex/lsrc/qemu.git:/home/alex/lsrc/qemu.git:ro,z', 'qemu/debian-hexagon-cross', 'hexagon-unknown-linux-musl-clang', '-Wno-incompatible-pointer-types', '-Wno-undefined-internal', '-fno-unroll-loops', '-fno-stack-protector', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-Wno-stringop-overread', '-mv73', '-O2', '-static', '/home/alex/lsrc/qemu.git/tests/tcg/multiarch/sha1.c', '-o', 'sha1', '-static']' returned non-zero exit status 1. filter=--filter=label=com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea
make[1]: *** [Makefile:122: sha1] Error 1
make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:52: build-tcg-tests-hexagon-linux-user] Error 2
Quoted 8 lines
Quoted 1 line
Is it that new an option?
I think it's new-ish (gcc 11?). On the other hand -Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overreaddoes that work?
Yes, I did:
modified tests/tcg/hexagon/Makefile.target
@@ -18,7 +18,7 @@
# Hexagon doesn't support gdb, so skip the EXTRA_RUNS EXTRA_RUNS =
-CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal
+CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal -Wno-unknown-warning-option
CFLAGS += -fno-unroll-loops -fno-stack-protector
Quoted 7 lines
(Meson has
cc.get_supported_arguments()that we can use to filter out -Wfoo/-Wno-foo options that the compiler doesn't support, but since this is built via a makefile rather than by meson that's not conveniently accessible.)-- PMM
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 13 lines · Alex Bennée
Quoted 6 lines · Peter Maydell
I think it's new-ish (gcc 11?). On the other hand -Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overreaddoes that work?
Yes, I did:
modified tests/tcg/hexagon/Makefile.target
Review line 22
Quoted 6 lines
(quoted diff) +1
-1@@ -18,7 +18,7 @@ # Hexagon doesn't support gdb, so skip the EXTRA_RUNS EXTRA_RUNS = -CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal +CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal -Wno-unknown-warning-option CFLAGS += -fno-unroll-loops -fno-stack-protector
I think we should do this where we add -Wno-stringop-overread, not just for the hexagon tests -- or are the tcg tests guaranteed to be run with a fixed compiler from a container regardless of the local dev environment?
-- PMm
Quoted 17 lines · Peter Maydell
Quoted 16 lines · Alex Bennée
Quoted 6 lines · Peter Maydell
I think it's new-ish (gcc 11?). On the other hand -Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overreaddoes that work?
Yes, I did:
modified tests/tcg/hexagon/Makefile.target
(quoted diff) +0
-0@@ -18,7 +18,7 @@ # Hexagon doesn't support gdb, so skip the EXTRA_RUNS EXTRA_RUNS =
Quoted 8 lines
Review line 22
Quoted 3 lines
(quoted diff) +1
-1-CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal +CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal -Wno-unknown-warning-option CFLAGS += -fno-unroll-loops -fno-stack-protectorI think we should do this where we add -Wno-stringop-overread, not just for the hexagon tests -- or are the tcg tests guaranteed to be run with a fixed compiler from a container regardless of the local dev environment?
I can move it, but hexagon is unusual in being clang based. However the oldest compilers we use are 10.2 in the qemu/debian-legacy-test-cross container.
Quoted 2 lines
-- PMm
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 29 lines · Alex Bennée
Quoted 17 lines · Peter Maydell
Quoted 16 lines · Alex Bennée
Quoted 6 lines · Peter Maydell
I think it's new-ish (gcc 11?). On the other hand -Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overreaddoes that work?
Yes, I did:
modified tests/tcg/hexagon/Makefile.target
(quoted diff) +0
-0@@ -18,7 +18,7 @@ # Hexagon doesn't support gdb, so skip the EXTRA_RUNS EXTRA_RUNS =Quoted 8 lines
Review line 22
Quoted 3 lines
(quoted diff) +1
-1-CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal +CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal -Wno-unknown-warning-option CFLAGS += -fno-unroll-loops -fno-stack-protectorI think we should do this where we add -Wno-stringop-overread, not just for the hexagon tests -- or are the tcg tests guaranteed to be run with a fixed compiler from a container regardless of the local dev environment?
Quoted 3 lines
I can move it, but hexagon is unusual in being clang based. However the oldest compilers we use are 10.2 in the qemu/debian-legacy-test-cross container.
My question was more "do we only ever build this test with a fixed set of compilers that we control, or are we instead maybe sometimes using the user's clang/cc/gcc" ? If the latter, we definitely need to associate the "don't warn about unknown warnings" with the place we are adding the option that's not known across all our supported compilers. If the former, then putting it in the hexagon specific file seems OK I guess.
-- PMM
Quoted 30 lines · Peter Maydell
Quoted 29 lines · Alex Bennée
Quoted 25 lines · Peter Maydell
Quoted 13 lines · Alex Bennée
Quoted 6 lines · Peter Maydell
I think it's new-ish (gcc 11?). On the other hand -Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overreaddoes that work?
Yes, I did:
modified tests/tcg/hexagon/Makefile.target
Review line 22
Quoted 6 lines
(quoted diff) +1
-1@@ -18,7 +18,7 @@ # Hexagon doesn't support gdb, so skip the EXTRA_RUNS EXTRA_RUNS = -CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal +CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal -Wno-unknown-warning-option CFLAGS += -fno-unroll-loops -fno-stack-protectorI think we should do this where we add -Wno-stringop-overread, not just for the hexagon tests -- or are the tcg tests guaranteed to be run with a fixed compiler from a container regardless of the local dev environment?
Quoted 7 lines
Quoted 3 lines
I can move it, but hexagon is unusual in being clang based. However the oldest compilers we use are 10.2 in the qemu/debian-legacy-test-cross container.
My question was more "do we only ever build this test with a fixed set of compilers that we control, or are we instead maybe sometimes using the user's clang/cc/gcc" ?
Its certainly possible - at least on a Debian system or with the appropriate --cross-cc-$ARCH flags. I expect 99% of devs either have Debian or Docker/Podman to fall back on.
Quoted 7 lines
If the latter, we definitely need to associate the "don't warn about unknown warnings" with the place we are adding the option that's not known across all our supported compilers. If the former, then putting it in the hexagon specific file seems OK I guess.
-- PMM
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 36 lines · Peter Maydell
Quoted 35 lines · Alex Bennée
tests/tcg/multiarch/Makefile.target vma-pthread: LDFLAGS+=-pthread · line 55
Quoted 8 lines · Peter Maydell
tests/tcg/multiarch/Makefile.target +8
-0+# GCC versions 12/13/14/15 at least incorrectly complain about +# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 +# Since this is just a standard piece of library code we've borrowed for a +# TCG test case, suppress the warning rather than trying to modify the +# code to work around the compiler. +sha1: CFLAGS+=-Wno-stringop-overread +Sadly this breaks the hexagon compiler:
error: unknown warning option '-Wno-stringop-overread' [-Werror,-Wunknown-warning-option]
Traceback (most recent call last):
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 683, in <module>
sys.exit(main())
^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 679, in main
returnargs.cmdobj.run(args, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 657, in run
return Docker().run(cmd, False, quiet=args.quiet,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 370, in run
ret = self._do_check(["run", "--rm", "--label",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 247, in_do_check
returnsubprocess.check_call(self._command + cmd, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 413, incheck_call
raiseCalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea', '--userns=keep-id', '-u', '1000', '-w', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user', '-v', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:rw', '-v', '/home/alex/lsrc/qemu.git:/home/alex/lsrc/qemu.git:ro,z', 'qemu/debian-hexagon-cross', 'hexagon-unknown-linux-musl-clang', '-Wno-incompatible-pointer-types', '-Wno-undefined-internal', '-fno-unroll-loops', '-fno-stack-protector', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-Wno-stringop-overread', '-mv73', '-O2', '-static', '/home/alex/lsrc/qemu.git/tests/tcg/multiarch/sha1.c', '-o', 'sha1', '-static']' returned non-zero exit status 1. filter=--filter=label=com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea
make[1]: *** [Makefile:122: sha1] Error 1
make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:52: build-tcg-tests-hexagon-linux-user] Error 2
Quoted 2 lines
Quoted 1 line
Is it that new an option?
I think it's new-ish (gcc 11?). On the other hand
I was going to volunteer to update the toolchain used for hexagon to address this. But unfortunately this warning is still not supported in clang 21.
https://github.com/llvm/llvm-project/issues/72455 sounds like it's not very likely to arrive any time soon.
So "-Wno-unknown-warning-option" does indeed seem like a good workaround.
Quoted 12 lines
-Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overreaddoes that work?
(Meson has
cc.get_supported_arguments()that we can use to filter out -Wfoo/-Wno-foo options that the compiler doesn't support, but since this is built via a makefile rather than by meson that's not conveniently accessible.)-- PMM
Quoted 9 lines · Brian Cain
I was going to volunteer to update the toolchain used for hexagon to address this. But unfortunately this warning is still not supported in clang 21.
https://github.com/llvm/llvm-project/issues/72455 sounds like it's not very likely to arrive any time soon.
So "-Wno-unknown-warning-option" does indeed seem like a good workaround.
I think the main problem with clang is that it doesn't default to "don't complain about unknown warning options", whereas gcc does:
e104462:noble:qemu$ gcc -Wno-bang -o /tmp/hello /tmp/hello.c e104462:noble:qemu$ clang -Wno-bang -o /tmp/hello /tmp/hello.c
warning: unknown warning option '-Wno-bang' [-Wunknown-warning-option] 1 warning generated.
-- PMM
Quoted 45 lines · Brian Cain
Quoted 36 lines · Peter Maydell
Quoted 35 lines · Alex Bennée
tests/tcg/multiarch/Makefile.target vma-pthread: LDFLAGS+=-pthread · line 55
Quoted 8 lines · Peter Maydell
tests/tcg/multiarch/Makefile.target +8
-0+# GCC versions 12/13/14/15 at least incorrectly complain about +# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 +# Since this is just a standard piece of library code we've borrowed for a +# TCG test case, suppress the warning rather than trying to modify the +# code to work around the compiler. +sha1: CFLAGS+=-Wno-stringop-overread +Sadly this breaks the hexagon compiler:
error: unknown warning option '-Wno-stringop-overread' [-Werror,-Wunknown-warning-option]
Traceback (most recent call last):
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 683, in <module>
sys.exit(main())
^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 679, in main
returnargs.cmdobj.run(args, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 657, in run
return Docker().run(cmd, False, quiet=args.quiet,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 370, in run
ret = self._do_check(["run", "--rm", "--label",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/lsrc/qemu.git/tests/docker/docker.py", line 247, in_do_check
returnsubprocess.check_call(self._command + cmd, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 413, incheck_call
raiseCalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea', '--userns=keep-id', '-u', '1000', '-w', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user', '-v', '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:/home/alex/lsrc/qemu.git/builds/all/tests/tcg/hexagon-linux-user:rw', '-v', '/home/alex/lsrc/qemu.git:/home/alex/lsrc/qemu.git:ro,z', 'qemu/debian-hexagon-cross', 'hexagon-unknown-linux-musl-clang', '-Wno-incompatible-pointer-types', '-Wno-undefined-internal', '-fno-unroll-loops', '-fno-stack-protector', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-Wno-stringop-overread', '-mv73', '-O2', '-static', '/home/alex/lsrc/qemu.git/tests/tcg/multiarch/sha1.c', '-o', 'sha1', '-static']' returned non-zero exit status 1. filter=--filter=label=com.qemu.instance.uuid=5bbb7b6ed2ea4377b9b6d646859ec4ea
make[1]: *** [Makefile:122: sha1] Error 1
make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:52: build-tcg-tests-hexagon-linux-user] Error 2Quoted 2 lines
Quoted 1 line
Is it that new an option?
I think it's new-ish (gcc 11?). On the other hand
I was going to volunteer to update the toolchain used for hexagon to address this. But unfortunately this warning is still not supported in clang 21.
Quoted 10 lines
https://github.com/llvm/llvm-project/issues/72455 sounds like it's not very likely to arrive any time soon.
So "-Wno-unknown-warning-option" does indeed seem like a good workaround.
Quoted 3 lines
-Wno-unknown-warning-option is quite old, and would suppress this error. If we do
CFLAGS+=-Wno-unknown-warning-option -Wno-stringop-overread
Workaround is fine for the time being then.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro