Let's see where the temp.table is supposed to be freed.
I run the EXPLAIN for query with "and b=10 and b=11" commented out, and I
observe:
Breakpoint 2, setup_jtbm_semi_joins (join=0x7fff10026ae0, join_list=0xa33cc80, join_where=0x7fff10026ec8) at opt_subselect.cc:5173
(gdb) c
Continuing.
Breakpoint 1, create_tmp_table (thd=0xa33a078, param=0x7ffff4195310, fields=..., group=0x0, distinct=true, save_sum_fields=true, select_options=2147768832, rows_limit=18446744073709551615, table_alias=0xd23c12 "dummy", do_not_open=true) at sql_select.cc:14181
(gdb) c
Continuing.
Breakpoint 5, JOIN::cleanup (this=0x7fff10026ae0, full=true) at sql_select.cc:10426
(gdb) c
Continuing.
Breakpoint 3, free_tmp_table (thd=0xa33a078, entry=0x7fff1002b350) at sql_select.cc:15605
(gdb) wher
#0 free_tmp_table (thd=0xa33a078, entry=0x7fff1002b350) at sql_select.cc:15605
#1 0x0000000000718c30 in st_join_table::cleanup (this=0x7fff100299f0) at sql_select.cc:10128
#2 0x0000000000719774 in JOIN::cleanup (this=0x7fff10026ae0, full=true) at sql_select.cc:10444
#3 0x0000000000706c11 in JOIN::destroy (this=0x7fff10026ae0) at sql_select.cc:2838
#4 0x0000000000886b4b in st_select_lex::cleanup (this=0xa33cb10) at sql_union.cc:963
#5 0x0000000000886708 in st_select_lex_unit::cleanup (this=0xa33c608) at sql_union.cc:828
#6 0x000000000068f88e in mysql_parse (thd=0xa33a078, rawbuf=0x7fff100094f0 "explain \nselect * from t2 \nwhere \n t2.a in (select max(b) \n", ' ' <repeats 11 times>, "from t1 where a=3 and a=4 \n", ' ' <repeats 11 times>, "group by a)", length=120, found_semicolon=0x7ffff4196c98) at sql_parse.cc:6190
#7 0x0000000000681740 in dispatch_command (command=COM_QUERY, thd=0xa33a078, packet=0xa3b50c9 "", packet_length=120) at sql_parse.cc:1243
#8 0x0000000000680a2c in do_command (thd=0xa33a078) at sql_parse.cc:923
#9 0x000000000067d8c6 in handle_one_connection (arg=0xa33a078) at sql_connect.cc:1231
#10 0x0000003509c07d90 in start_thread (arg=0x7ffff4197700) at pthread_create.c:309
#11 0x00000035098f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb)
If I run SELECT (not EXPLAIN), I see:
Breakpoint 3, free_tmp_table (thd=0xa33a078, entry=0x7fff1002b350) at sql_select.cc:15605
(gdb) wher
#0 free_tmp_table (thd=0xa33a078, entry=0x7fff1002b350) at sql_select.cc:15605
#1 0x0000000000718c30 in st_join_table::cleanup (this=0x7fff10029370) at sql_select.cc:10128
#2 0x0000000000719774 in JOIN::cleanup (this=0x7fff10026430, full=true) at sql_select.cc:10444
#3 0x0000000000719471 in JOIN::join_free (this=0x7fff10026430) at sql_select.cc:10364
#4 0x000000000071a57d in return_zero_rows (join=0x7fff10026430, result=0x7fff10026410, tables=..., fields=..., send_row=false, select_options=2147764736, info=0xcffcc8 "no matching row in const table", having=0x0, all_fields=...) at sql_select.cc:10777
#5 0x0000000000704601 in JOIN::exec (this=0x7fff10026430) at sql_select.cc:2215
#6 0x00000000007071c5 in mysql_select (thd=0xa33a078, rref_pointer_array=0xa33cd68, tables=0x7fff10009788, wild_num=1, fields=..., conds=0x7fff10026200, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x7fff10026410, unit=0xa33c608, select_lex=0xa33cb10) at sql_select.cc:2999
#7 0x00000000006fdd39 in handle_select (thd=0xa33a078, lex=0xa33c568, result=0x7fff10026410, setup_tables_done_option=0) at sql_select.cc:288
...
"Regular" joins with SJM query plans produce no warning. The above example is somehow special.