c/4691: Incorrect warning that statement has no effect
Donald Gillies
dgillies@graviton.com
Fri Oct 26 09:16:00 GMT 2001
Here is the full (unsimplified) code.
boolean_t OW_ReadDallasUID(u_int8_t *p)
{
u_int8_t retry = MAX1WRETRY; // try max times to read Dallas ID
DS2401Z
u_int8_t CRC = 0;
u_int8_t i;
u_int8_t buf[8];
intrmask_t s;
UNIX(return(TRUE));
s = splhigh(); // disable all interrupts
while ( retry ) {
if (Reset()) { // No devices found
retry = 0;
break;
}
OW_WriteByte(0x33); // Send READ ROM command
for ( i = 8; i > 0; i--) {
buf[i-1] = OW_ReadByte();
// After all 8 bytes CRC should be 0
CRC = CRCTable[ (CRC ^ buf[i-1])];
}
// MSB( CRC ID ID ID ID ID ID CHIP_TYPE)
// LSB :: buf[0] = CRC, buf[7] = CHIP_TYPE
if (CRC == 0x00) { // if CRC OK, copy data to user
space
for (i = 0; i < 8; i++) // bcopy(buf, p, 8)
*p++ = buf[i];
break;
}
retry--;
}
splx(s); // restore interrupts
if (retry != 0) {
return TRUE;
}
else {
return FALSE;
}
}
-----Original Message-----
From: neil@gcc.gnu.org [ mailto:neil@gcc.gnu.org ]
Sent: Thursday, October 25, 2001 11:42 PM
To: Donald Gillies; gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org;
nobody@gcc.gnu.org
Subject: Re: c/4691: Incorrect warning that statement has no effect
Synopsis: Incorrect warning that statement has no effect
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Thu Oct 25 23:41:45 2001
State-Changed-Why:
Not a bug. Please look harder at the exact line the compiler
claims has no effect - the compiler is entirely right. 8-)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4691&da
tabase=gcc
More information about the Gcc-bugs
mailing list