NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
RE: port-hp300/50852: src/sys/arch/hp300/stand/common/ite.c:239: bad expression
The following reply was made to PR port-hp300/50852; it has been noted by GNATS.
From: David Binderman <dcb314%hotmail.com@localhost>
To: "gnats-bugs%NetBSD.org@localhost" <gnats-bugs%netbsd.org@localhost>,
"port-hp300-maintainer%netbsd.org@localhost" <port-hp300-maintainer%netbsd.org@localhost>,
"gnats-admin%netbsd.org@localhost" <gnats-admin%netbsd.org@localhost>, "netbsd-bugs%netbsd.org@localhost"
<netbsd-bugs%netbsd.org@localhost>
Cc:
Subject: RE: port-hp300/50852: src/sys/arch/hp300/stand/common/ite.c:239:
bad expression
Date: Fri, 26 Feb 2016 16:45:21 +0000
Hello there=2C=0A=
=0A=
----------------------------------------=0A=
> On Fri=2C Feb 26=2C 2016 at 10:55:00AM +0000=2C dcb314%hotmail.com@localhost wrote:=
=0A=
>>>Description:=0A=
>> [src/sys/arch/hp300/stand/common/ite.c:239]: (error) Expression 'whichco=
nsole=3D++whichconsole%(NITE+1)' depends on order of evaluation of side eff=
ects=0A=
>>=0A=
>> Source code is=0A=
>>=0A=
>> whichconsole =3D ++whichconsole % (NITE+1)=3B=0A=
>>=0A=
>> Maybe better code=0A=
>>=0A=
>> whichconsole =3D (whichconsole + 1) % (NITE+1)=3B=0A=
>=0A=
> Independent of the question of which code is better=2C I don't think the=
=0A=
> error is correct. =0A=
=0A=
False=2C the error is valid.=0A=
=0A=
There are two writes to whichconsole=2C one on the left of the assignment=
=2C=0A=
one on the right.=0A=
=0A=
The ISO standard doesn't define which order those writes occur.=0A=
See Steve Summit's C FAQ for sequence points=2C section 3.8.=0A=
=0A=
=0A=
Regards=0A=
=0A=
David Binderman=0A=
=0A=
31 years a C programmer=2C including C and C++ compiler development.=0A=
=
Home |
Main Index |
Thread Index |
Old Index