Either I'm confused or the gc is

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Oct 23 14:37:41 UTC 2020


On Fri, Oct 23, 2020 at 12:47:11PM +0000, donallen via Digitalmars-d wrote:
> On Thursday, 22 October 2020 at 21:58:04 UTC, rikki cattermole wrote:
> > On 23/10/2020 4:56 AM, donallen wrote:
> > > ==3854==    by 0x1B7E98: void verifier.main(immutable(char)[][]).walk_account_tree(verifier.main(immutable(char)[][]).Account,
> > > int) (verifier.d:272)
> > > ==3854==  Uninitialised value was created by a stack allocation
> > > ==3854==    at 0x1B77FC: void verifier.main(immutable(char)[][]).walk_account_tree(verifier.main(immutable(char)[][]).Account,
> > > int) (verifier.d:84)
> > > ==3854==
> > > ==3854== Conditional jump or move depends on uninitialised value(s)
[...]

Hmm. Which lines in your posted code do lines 272 and 84 refer to?
Those seem to be the problematic spots, but it's not clear where in the
function they are, since your posted code doesn't indicate line numbers.


I also noticed this bit of code (which may or may not have anything to
do with it):

>                 int temp;
>                 if ((temp = one_row(check_quantities,
> &get_int).integer_value) > 0)
>                 {
>                     writeln(account.path,
>                             " %s is not an asset account but has splits with
> non-zero quantities. These will be fixed.");
> 
>                     bind_text(fix_quantities, 1, account.guid);
>                     run_dm_stmt(fix_quantities, &reset_stmt);
>                 }

The value of `temp` is not used after assignment. This is a rather odd
way of writing it.  What's the reason you didn't just write:

	if (one_row(...) > 0)

instead?


[...]
> MultiType one_row(T)(sqlite3_stmt* stmt, T get_values)

What's the definition of MultiType?


[...]
>     return result; // Need this for compiler happiness -- can't get here

Note for the future: you could write `assert(0);` here to indicate that
it should not be reachable. (It compiles to a single 'hlt' instruction,
which will abort if the program somehow reaches it anyway.)


T

-- 
My program has no bugs! Only unintentional features...


More information about the Digitalmars-d mailing list