Skip to contentSkip to conversation

error: ctype on uninitialized symbol

DISCUSSION Bob Copeland 1 participant 2 messages Feb 1, 2016 – Feb 2, 2016 Sparse checker

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm seeing the following error when running sparse with latest HEAD, against the small test case at the end:

$ sparse sparse-test.c
[garbage]:0:0: error: ctype on uninitialized symbol 0x696ec0

I am getting this with calls to time_after(..., msecs_to_jiffies()) in my kernel build.

Below, the "1UL + 1L" is a stand-in for MAX_JIFFY_OFFSET, and the value has to be some operation on two different types to trigger for me (e.g. 1UL + 1UL will run without error). Taking out the typecheck macro will also remove the error.

Any thoughts?

$ sparse --version
v0.5.0-44-g40791b9

sparse-test.c:

#define typecheck(type,x) \

({	type __dummy; \
	typeof(x) __dummy2; \
	(void)(&__dummy == &__dummy2); \
	1; \
})
#define time_after(a,b)		\
	(typecheck(unsigned long, a) && \
	 typecheck(unsigned long, b) && \
	 ((long)((b) - (a)) < 0))

static inline unsigned long y(void)

{
	return 1UL+1L;
}

static void x(void)

{
	int c = time_after(1UL, y());
}
Signature · 1 line
Bob Copeland %% http://bobcopeland.com/
#1 lore raw
Quoted 7 lines · Bob Copeland

Hi all,

I'm seeing the following error when running sparse with latest HEAD, against the small test case at the end:

$ sparse sparse-test.c
[garbage]:0:0: error: ctype on uninitialized symbol 0x696ec0

Nevermind, I fooled myself. Turns out this "sparse" was an old version of smatch, not the freshly-built sparse that "sparse --version" was reporting.

It looks like this bug was fixed around 0.4.4.

Sorry for the noise!

Signature · 1 line
Bob Copeland %% http://bobcopeland.com/