[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: uninitialized data in t-test-alpha.sh
From: |
Ben Pfaff |
Subject: |
Re: uninitialized data in t-test-alpha.sh |
Date: |
Sat, 09 Dec 2006 18:01:21 -0800 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
John Darrington <address@hidden> writes:
> On Sat, Dec 09, 2006 at 01:42:15PM -0800, Ben Pfaff wrote:
> I'm seeing the following warning from valgrind on
> t-test-alpha.sh:
>
> ==4900== Conditional jump or move depends on uninitialised value(s)
> ==4900== at 0x80CF84F: casefilter_variable_missing (casefilter.c:63)
>
> This highlights an issue which has been concerning me for some time.
>
> The line at question says:
> if ( val->f == SYSMIS )
>
> which is fine, if the variable to which val belongs is numeric. But
> in this case, it is a string variable (with a width less than sizeof
> (flt64) ).
>
> Can string variables ever be SYSMIS? and is it ever valid to compare
> them to SYSMIS ?
I'd discourage going down the road of comparing strings to
SYSMIS, especially if they might be shorter than
MAX_SHORT_STRING. You could just get unlucky and be processing a
string that happens to have the same bit pattern as SYSMIS.
I'd check the variable type before making that comparison.
--
"The road to hell is paved with convenient shortcuts."
--Peter da Silva