Page MenuHome GnuPG

primegen.c: uses is_locked, which appears to suffer a race
Closed, WontfixPublic

Description

The issues below were flagged as a dead store, but I think they might indicate
another issue. If is_locked acts as a lock in a multithreaded program, then they
should probably be an atomic.

libtool: compile: /usr/local/bin/scan-build/ccc-analyzer -DHAVE_CONFIG_H -I.
-I.. -I../src -I../src -I/usr/local/include -g3 -O1 -fvisibility=hidden -Wall
-MT primegen.lo -MD -MP -MF .deps/primegen.Tpo -c primegen.c -o primegen.o

primegen.c:491:11: warning: Value stored to 'is_locked' is never read

is_locked = 0;
^           ~

primegen.c:530:11: warning: Value stored to 'is_locked' is never read

is_locked = 0;
^           ~

primegen.c:708:7: warning: Value stored to 'is_locked' is never read

is_locked = 0;
^           ~

3 warnings generated.

Details

Version
1.6.3

Event Timeline

JW added a project: libgcrypt.
JW added a subscriber: JW.
werner added a subscriber: werner.

Sure it used and thus read! You only need to look at the code for 5 seconds!
And no, it is not a lock. Read the comment at the var definition.

marcus claimed this task.