Query cache destroys uninitialized rwlock

Description

The following tests crashes the server when compiled with -DUSE_MUTEX_INSTEAD_OF_RW_LOCKS:
main.cache_innodb
main.mysql_client_test
main.mysql_client_test_nonblock
main.partition_cache
main.query_cache
main.query_cache_debug
main.query_cache_notembedded
main.query_cache_ps_no_prot
perfschema.query_cache
rpl.rpl_row_basic_11bugs
sys_vars.query_cache_limit_func
sys_vars.query_cache_type_func

A simpler way to reproduce crash is to compile with the following patch:

Test case:

Stack trace:

Environment

None

Assignee

Oleksandr Byelkin

Reporter

Sergey Vojtovich

Labels

None

Fix versions

Affects versions

Priority

Major
Configure