target-arm/translate-a64.c:2028: possible coding error ?

Bug #1625987 reported by dcb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

target-arm/translate-a64.c:2028:37: warning: ?: using integer constants in boolean context [-Wint-in-bool-context]

Source code is

        bool iss_sf = opc == 0 ? 32 : 64;

Maybe better code

        bool iss_sf = (opc == 0) ? 32 : 64;

Revision history for this message
Peter Maydell (pmaydell) wrote :

This is clearly a bug, but your suggested change won't deal with the problem, which is that we're trying to set a bool so the ? 32 : 64 construct is just wrong.

Revision history for this message
Peter Maydell (pmaydell) wrote : Re: [Qemu-devel] [Bug 1625987] Re: target-arm/translate-a64.c:2028: possible coding error ?

On 22 September 2016 at 02:53, Peter Maydell <email address hidden> wrote:
> This is clearly a bug, but your suggested change won't deal with the
> problem, which is that we're trying to set a bool so the ? 32 : 64
> construct is just wrong.

> Bug description:
> target-arm/translate-a64.c:2028:37: warning: ?: using integer
> constants in boolean context [-Wint-in-bool-context]
>
> Source code is
>
> bool iss_sf = opc == 0 ? 32 : 64;

Edgar, did you want to look at a fix for this? It was introduced
in your commit aaa1f954d4 adding syndrome info for loads and stores.

thanks
-- PMM

Revision history for this message
Edgar E. Iglesias (edgar-iglesias) wrote :

On Thu, Sep 29, 2016 at 06:40:53PM -0700, Peter Maydell wrote:
> On 22 September 2016 at 02:53, Peter Maydell <email address hidden> wrote:
> > This is clearly a bug, but your suggested change won't deal with the
> > problem, which is that we're trying to set a bool so the ? 32 : 64
> > construct is just wrong.
>
> > Bug description:
> > target-arm/translate-a64.c:2028:37: warning: ?: using integer
> > constants in boolean context [-Wint-in-bool-context]
> >
> > Source code is
> >
> > bool iss_sf = opc == 0 ? 32 : 64;
>
> Edgar, did you want to look at a fix for this? It was introduced
> in your commit aaa1f954d4 adding syndrome info for loads and stores.

Hi Peter,

Yes, I've just posted a fix to the list.
It should have been:

bool iss_sf = opc == 0 ? false : true;

Cheers,
Edgar

Revision history for this message
Peter Maydell (pmaydell) wrote :

Now fixed in master, commit 173ff58580b383a7841.

Changed in qemu:
status: New → Fix Committed
Revision history for this message
Thomas Huth (th-huth) wrote :

Released with v2.8

Changed in qemu:
status: Fix Committed → Fix Released
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.