Bug #3956 Valgrind reports error for sum_distict.test
Submitted: 1 Jun 2004 19:33 Modified: 6 Oct 2004 14:53
Reporter: Sergey Petrunya Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0-bk OS:
Assigned to: Per-Erik Martin CPU Architecture:Any

[1 Jun 2004 19:33] Sergey Petrunya
Description:
Running sum_distinct.test on 5.0 compiled with valgrind produces valgrind errors. 
The test passes though.
The reported error mentions a gcc 2.96 or 3.0X bug but the compiler was 
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

How to repeat:
Run ./mysql-test-run --valgrind t/sum_distinct.test and see the following in 
var/log/master.err:
 Invalid read of size 4
    at 0x83E9DFA: reinit_io_cache (mf_iocache.c:341)
    by 0x81F45A2: filesort(THD*, st_table*, st_sort_field*, unsigned, SQL_SELECT*, unsigned long, unsigned long*) (filesort.cc:250)
    by 0x81B4F03: create_sort_index(THD*, JOIN*, st_order*, unsigned long, unsigned long) (sql_select.cc:8306)
    by 0x81A64E7: JOIN::exec() (sql_select.cc:1534)
    by 0x81A69D5: _Z12mysql_selectP3THDPPP4ItemP13st_table_listjR4ListIS1_ES2_jP8st_orderSB_S2_SB_mP13select_resultP18st_select_lex_unitP13st_select_lex (sql_select.cc:1666)
    by 0x81A2E10: handle_select(THD*, st_lex*, select_result*) (sql_select.cc:203)
    by 0x817C925: mysql_execute_command(THD*) (sql_parse.cc:2616)
    by 0x818014B: mysql_parse(THD*, char*, unsigned) (sql_parse.cc:4181)
    by 0x8179B7C: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1475)
    by 0x8179533: do_command(THD*) (sql_parse.cc:1290)
    by 0x8178A48: handle_one_connection (sql_parse.cc:1028)
    by 0x40224572: thread_wrapper (vg_libpthread.c:667)
    by 0x4016C667: do__quit (vg_scheduler.c:2146)
    Address 0x461DB1E8 is just below %esp.  Possibly a bug in GCC/G++
    v 2.96 or 3.0.X.  To suppress, use: --workaround-gcc296-bugs=yes
 valgrind's libpthread.so: KLUDGED call to: pthread_cond_destroy
[6 Oct 2004 14:53] Per-Erik Martin
Even if this happens with newer gcc versions, I still think it's the same problem as for gcc 2.96. I can't see any reason for this in the code, and when running the test with the valgrind option "--workaround-gcc296-bugs=yes" it passes.