Hi,

I'm running some Postgres extension under Valgrind memcheck. It reports
the following error:

==20263== VALGRINDERROR-BEGIN
==20263== Use of uninitialised value of size 8
==20263==    at 0xC4DA9B8: fill_prel_with_partitions (relation_info.c:737)
==20263==    by 0xC4D9F94: build_pathman_relation_info (relation_info.c:464)
==20263==    by 0xC4D9A4F: get_pathman_relation_info (relation_info.c:351)
==20263==    by 0xC4D9925: has_pathman_relation_info (relation_info.c:307)
==20263==    by 0xC4E8930: add_to_pathman_config (pl_funcs.c:859)
==20263==    by 0x4400EC: ExecInterpExpr (execExprInterp.c:654)
==20263==    by 0x441D38: ExecInterpExprStillValid (execExprInterp.c:1786)
==20263==    by 0x484EF1: ExecEvalExprSwitchContext (executor.h:303)
==20263==    by 0x484F5A: ExecProject (executor.h:337)
==20263==    by 0x485139: ExecResult (nodeResult.c:136)
==20263==    by 0x455460: ExecProcNodeFirst (execProcnode.c:445)
==20263==    by 0x449CF7: ExecProcNode (executor.h:237)
==20263==    by 0x44C6FC: ExecutePlan (execMain.c:1727)
==20263==    by 0x44A30E: standard_ExecutorRun (execMain.c:365)
==20263==    by 0x44A115: ExecutorRun (execMain.c:307)
==20263==    by 0x49A9AE: _SPI_pquery (spi.c:2493)
==20263==    by 0x49A3BF: _SPI_execute_plan (spi.c:2255)
==20263==    by 0x497179: SPI_execute_plan_with_paramlist (spi.c:531)
==20263==    by 0xD940BD8: exec_run_select (pl_exec.c:5983)
==20263==    by 0xD9395F2: exec_stmt_perform (pl_exec.c:2222)
==20263==  Uninitialised value was created by a stack allocation
==20263==    at 0xC4D5D50: ??? (in 
/home/ars/postgres/install/ee11/lib/pg_pathman.so)
==20263==
==20263== VALGRINDERROR-END

Everything is built with debug symbols and with -O0. As you see,
Valgrind can't determine function where stack allocation took
place. Indeed, address 0xC4D5D50 is not of any function. Recalculating
it into an offset, it is 0xED50. Here is a part of nm -n output:

ars@ars-thinkpad $ nm -n /home/ars/postgres/install/ee11/lib/pg_pathman.so
000000000003d760 r __FUNCTION__.23753
000000000003d77c r __GNU_EH_FRAME_HDR
0000000000042f88 r __FRAME_END__
00000000002439e8 t __frame_dummy_init_array_entry

Does it look like a bug in Valgrind?

Moreover, looking at the code I don't actually believe there is
an uinitialized value. Here is the relevant code:

 731         switch (prel->parttype)
 732         {
 733             case PT_HASH:
 734                 child_relid = pbin->child_relid;
 735                 children = prel->children;
 736                 part_idx = pbin->part_idx;
 737                 children[part_idx] = child_relid;
 738                 break;

The only 8-byte value at line 737 is 'children'. I am pretty sure that
prel->children is initialized, and anyway line 735 is not declared as
offending.

Valgrind version is valgrind-3.12.0.SVN. Run options are

        valgrind --tool=memcheck --trace-children=yes --track-origins=yes \
                 --read-var-info=yes --num-callers=20 --leak-check=no \
                 --gen-suppressions=all --error-limit=no \
                 --suppressions="${PGSDIR}/src/tools/valgrind.supp" \
                 --error-markers=VALGRINDERROR-BEGIN,VALGRINDERROR-END \


--
Best regards,
Arseny Sher


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to