Menu

#44 False alarm when accessing volatile

open
nobody
None
5
2007-06-30
2007-06-30
Anonymous
No

Accessing a volatile has a side effect as defined by the C standard, but splint does not make difference between accessing volatiles and non-volatiles:

static volatile unsigned short vv;
static unsigned short nv;

void f( void )
{
vv;
nv;
}

splint warnings:
----------------
Splint 3.1.1.2 --- 27 May 2007

redef.c: (in function f)
redef.c:6:3: Statement has no effect: vv
Statement has no visible effect --- no values are modified. (Use -noeffect to inhibit warning)
redef.c:7:3: Statement has no effect: nv

Finished checking --- 2 code warnings

gcc warnings:
-------------
$ gcc -fsyntax-only -Wall redef.c
redef.c: In function `f':
redef.c:7: warning: statement with no effect

br
pkzc at freemail dot hu

Discussion


Log in to post a comment.