qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org,  qemu-devel@nongnu.org,
	Brian Cain <brian.cain@oss.qualcomm.com>
Subject: Re: [PATCH] tests/tcg: Suppress compiler false-positive warning on sha1.c
Date: Tue, 04 Mar 2025 11:56:49 +0000	[thread overview]
Message-ID: <87o6yh57r2.fsf@draig.linaro.org> (raw)
In-Reply-To: <20250227141343.1675415-1-peter.maydell@linaro.org> (Peter Maydell's message of "Thu, 27 Feb 2025 14:13:43 +0000")

Peter Maydell <peter.maydell@linaro.org> writes:

> 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.
<snip>
> --- a/tests/tcg/multiarch/Makefile.target
> +++ b/tests/tcg/multiarch/Makefile.target
> @@ -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
> +

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?

>  # 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),)

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  parent reply	other threads:[~2025-03-04 11:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 14:13 [PATCH] tests/tcg: Suppress compiler false-positive warning on sha1.c Peter Maydell
2025-02-27 16:35 ` Richard Henderson
2025-02-27 22:23 ` Alex Bennée
2025-03-04 11:56 ` Alex Bennée [this message]
2025-03-04 12:51   ` Peter Maydell
2025-03-04 13:44     ` Alex Bennée
2025-03-04 13:53       ` Peter Maydell
2025-03-04 14:29         ` Alex Bennée
2025-03-04 14:36           ` Peter Maydell
2025-03-04 15:58             ` Alex Bennée
2025-03-05 14:56     ` Brian Cain
2025-03-05 16:52       ` Peter Maydell
2025-03-05 16:56       ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o6yh57r2.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).