All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Stefan Weil <sw@weilnetz.de>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] tci build failure (was Re:  [PULL v5 00/22] virtio, vhost, pci: fixes, features)
Date: Thu, 2 Feb 2017 21:08:46 +0200	[thread overview]
Message-ID: <20170202210558-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAFEAcA_SCHQ06uON3pEgpt2ku4HO2C-fUTHr7TZAVmZ1PEq09Q@mail.gmail.com>

On Thu, Feb 02, 2017 at 04:25:34PM +0000, Peter Maydell wrote:
> On 2 February 2017 at 13:56, Peter Maydell <peter.maydell@linaro.org> wrote:
> > On 31 January 2017 at 20:18, Michael S. Tsirkin <mst@redhat.com> wrote:
> >> virtio, vhost, pci: fixes, features
> >>
> >> generic pci root port support
> >> disable shpc by default
> >> safer version of ARRAY_SIZE and QEMU_BUILD_BUG_ON
> >> fixes and cleanups all over the place
> >>
> >> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> > Applied, thanks.
> 
> ...travis builds now fail for the --enable-tcg-interpreter config:
> https://travis-ci.org/qemu/qemu/jobs/197648661
> 
> In file included from /home/travis/build/qemu/qemu/tcg/tcg.c:255:0:
> /home/travis/build/qemu/qemu/tcg/tci/tcg-target.inc.c: In function ‘tcg_out_op’:
> /home/travis/build/qemu/qemu/tcg/tci/tcg-target.inc.c:569:117: error:
> negative width in bit-field ‘<anonymous>’
> /home/travis/build/qemu/qemu/tcg/tci/tcg-target.inc.c:569:255: error:
> negative width in bit-field ‘<anonymous>’
> In file included from /home/travis/build/qemu/qemu/tcg/tcg.c:255:0:
> /home/travis/build/qemu/qemu/tcg/tci/tcg-target.inc.c:578:115: error:
> negative width in bit-field ‘<anonymous>’
> /home/travis/build/qemu/qemu/tcg/tci/tcg-target.inc.c:578:255: error:
> negative width in bit-field ‘<anonymous>’
> 
> These look to be because we were trying to use ARRAY_SIZE()
> on a non-array, which was previously undetected. The use is
> only in an assert() so fairly harmless.
> 
> Would somebody who cares about TCI like to provide a fix?
> 
> thanks
> -- PMM

I think the following should do it. Completely untested.

-->

tcg/tci: fix ARRAY_SIZE misuse

tb_jmp_insn_offset and tb_jmp_reset_offset are
pointers, not arrays, so using ARRAY_SIZE on them will
not do the right thing.

They point to arrays within TranslationBlock so check
the size of these instead.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

--

diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c
index 26ee9b1..a2ba654 100644
--- a/tcg/tci/tcg-target.inc.c
+++ b/tcg/tci/tcg-target.inc.c
@@ -556,6 +556,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
                        const int *const_args)
 {
     uint8_t *old_code_ptr = s->code_ptr;
+    TranslationBlock *tb;
 
     tcg_out_op_t(s, opc);
 
@@ -566,7 +567,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
     case INDEX_op_goto_tb:
         if (s->tb_jmp_insn_offset) {
             /* Direct jump method. */
-            tcg_debug_assert(args[0] < ARRAY_SIZE(s->tb_jmp_insn_offset));
+            tcg_debug_assert(args[0] < ARRAY_SIZE(tb->jmp_insn_offset));
             /* Align for atomic patching and thread safety */
             s->code_ptr = QEMU_ALIGN_PTR_UP(s->code_ptr, 4);
             s->tb_jmp_insn_offset[args[0]] = tcg_current_code_size(s);
@@ -575,7 +576,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
             /* Indirect jump method. */
             TODO();
         }
-        tcg_debug_assert(args[0] < ARRAY_SIZE(s->tb_jmp_reset_offset));
+        tcg_debug_assert(args[0] < ARRAY_SIZE(tb->jmp_reset_offset));
         s->tb_jmp_reset_offset[args[0]] = tcg_current_code_size(s);
         break;
     case INDEX_op_br:

      parent reply	other threads:[~2017-02-02 19:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31 20:18 [Qemu-devel] [PULL v5 00/22] virtio, vhost, pci: fixes, features Michael S. Tsirkin
2017-01-31 20:18 ` [Qemu-devel] [PULL v5 01/22] compiler: drop ; after BUILD_BUG_ON Michael S. Tsirkin
2017-01-31 20:18 ` [Qemu-devel] [PULL v5 02/22] qxl: switch to constants within BUILD_BUG_ON Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 03/22] ppc: " Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 04/22] QEMU_BUILD_BUG_ON: use __COUNTER__ Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 05/22] compiler: rework BUG_ON using a struct Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 06/22] compiler: expression version of QEMU_BUILD_BUG_ON Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 07/22] ARRAY_SIZE: check that argument is an array Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 08/22] pci: mark ROMs read-only Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 09/22] intel_iommu: fix and simplify size calculation in process_device_iotlb_desc() Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 10/22] hw/pcie: Introduce a base class for PCI Express Root Ports Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 11/22] hw/ioh3420: derive from PCI Express Root Port base class Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 12/22] hw/pcie: Introduce Generic PCI Express Root Port Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 13/22] hw/i386: check if nvdimm is enabled before plugging Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 14/22] msix: Follow CODING_STYLE Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 15/22] hcd-xhci: check & correct param before using it Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 16/22] pci: Convert msix_init() to Error and fix callers Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 17/22] virtio: make virtio_should_notify static Michael S. Tsirkin
2017-01-31 20:19 ` [Qemu-devel] [PULL v5 18/22] vhost: skip ROM sections Michael S. Tsirkin
2017-01-31 20:20 ` [Qemu-devel] [PULL v5 19/22] vhost-user: delete chardev on cleanup Michael S. Tsirkin
2017-01-31 20:20 ` [Qemu-devel] [PULL v5 20/22] hw/pci: disable pci-bridge's shpc by default Michael S. Tsirkin
2017-01-31 20:20 ` [Qemu-arm] [PULL v5 21/22] arm: better stub version for MISMATCH_CHECK Michael S. Tsirkin
2017-01-31 20:20   ` [Qemu-devel] " Michael S. Tsirkin
2017-01-31 20:20 ` [Qemu-arm] [PULL v5 22/22] arm: add trailing ; after MISMATCH_CHECK Michael S. Tsirkin
2017-01-31 20:20   ` [Qemu-devel] " Michael S. Tsirkin
2017-02-02 13:56 ` [Qemu-devel] [PULL v5 00/22] virtio, vhost, pci: fixes, features Peter Maydell
2017-02-02 16:25   ` Peter Maydell
2017-02-02 19:01     ` Stefan Weil
2017-02-02 19:08     ` Michael S. Tsirkin [this message]

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=20170202210558-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sw@weilnetz.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.