Bug #75375 self assignment
Submitted: 1 Jan 2015 11:14 Modified: 1 Jan 2015 13:25
Reporter: Joshua Rogers Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Security: Encryption Severity:S3 (Non-critical)
Version:5.7.6 OS:Any
Assigned to: CPU Architecture:Any

[1 Jan 2015 11:14] Joshua Rogers
Description:
/extra/yassl/src/handshake.cpp:

 80    hello.compression_method_ = hello.compression_method_;

why?

How to repeat:
.

Suggested fix:
.
[1 Jan 2015 11:15] Joshua Rogers
same in /storage/federated/ha_federated.cc:

 827      share->username= share->username;
[1 Jan 2015 13:25] MySQL Verification Team
For simple types, I see no benefit to self-assignment except to get rid of compiler warnings.

I checked in a win32 release build, the compiler optimized away the code totally.   On a debug build, we see:

share->username= share->username;
015D380B  mov         edx,dword ptr [share]  
015D380E  mov         eax,dword ptr [share]  
015D3811  mov         ecx,dword ptr [eax+44h]  
015D3814  mov         dword ptr [edx+44h],ecx  

hello.compression_method_ = hello.compression_method_;
01AA5CD0  mov         ecx,dword ptr [hello]  
01AA5CD3  mov         edx,dword ptr [hello]  
01AA5CD6  mov         eax,dword ptr [edx+50h]  
01AA5CD9  mov         dword ptr [ecx+50h],eax