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



Hello there,

----------------------------------------
> On Fri, Feb 26, 2016 at 10:55:00AM +0000, dcb314%hotmail.com@localhost wrote:
>>>Description:
>> [src/sys/arch/hp300/stand/common/ite.c:239]: (error) Expression 'whichconsole=++whichconsole%(NITE+1)' depends on order of evaluation of side effects
>>
>> Source code is
>>
>> whichconsole = ++whichconsole % (NITE+1);
>>
>> Maybe better code
>>
>> whichconsole = (whichconsole + 1) % (NITE+1);
>
> Independent of the question of which code is better, I don't think the
> error is correct. 

False, the error is valid.

There are two writes to whichconsole, one on the left of the assignment,
one on the right.

The ISO standard doesn't define which order those writes occur.
See Steve Summit's C FAQ for sequence points, section 3.8.


Regards

David Binderman

31 years a C programmer, including C and C++ compiler development.
 		 	   		  


Home | Main Index | Thread Index | Old Index