Bug #3767 Incorrect code in strings-x86.s
Submitted: 15 May 2004 2:37 Modified: 21 May 2004 1:36
Reporter: Karl Weinert Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.18 OS:Multiple
Assigned to: CPU Architecture:Any

[15 May 2004 2:37] Karl Weinert
Description:
I am not sure what kind of problems this will cause but the code in strings-x86.s has an error

<snip>
strxmov:
	movl	%ebx,%edx		#  Save %ebx, %esi and %edi
	mov	%esi,%ecx
	push	%edi
	leal	8(%esp),%ebx		#  Get destination
	movl	(%ebx),%edi
	xorb	%al,%al
	jmp	next_str		#  Handle source ebx+4

start_str:
	movsb
	cmpb	-1(%edi),%al
	jne	start_str
	decl	%edi			#  Don't copy last null

next_str:
	addl	$4,%ebx
	movl	(%ebx),%esi
	orl	%esi,%esi
	jne	start_str
	movb	%al,0(%edi)		#  Force last to ASCII 0

	movl	%edi,%eax		#  Return ptr to ASCII 0
	pop	%edi			#  Restore registers
	movl	%ecx,%esi
	movl	%edx,%ebx
	ret
.strxmov_end:
	.size	 strxmov,strxmov_end-strxmov
//end of file

The
.strxmov_end:
	.size	 strxmov,strxmov_end-strxmov

Should be
.strxmov_end:
	.size	 strxmov,.strxmov_end-strxmov
Note the period before .strxmov_end-strxmov.

a readelf of the strings-x86.o shows
58: 000001b8  -440 FUNC    GLOBAL DEFAULT    1 strxmov
59: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND strxmov_end
Note the -440

How to repeat:
N/A

Suggested fix:
add a period before strxmov_end-strxmov :-)
[21 May 2004 1:36] Timothy Smith
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

Additional info:

This (and a similar typo in longlong2str-x86.s) is fixed in 4.0.20.

It is interesting, these typos have been present in MySQL for a very long time, and now we have two independent people who noticed them within several weeks of each other.