wrong datatype in stdlib/merge.c

看板FB_bugs作者時間15年前 (2010/05/20 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
Hi all, this file hasn't been touch for quite a while, so I'm wondering why nobody discovered this bug before. Location: in src/lib/libc/stdlib/merge.c in function setup() What is wrong: variable 'tmp' is an 'int' type Correction: this variable 'tmp' should be an 'u_char' type While this variable 'tmp' is used correctly in the other function insertionsort(), it is here (in setup) used incorrectly. At best, the compiler detects this problem (icc for example issues a remark) and corrects it automatically. More likely (gcc?) it just turns into unnecessary type conversions, leading to some performance loss. In the worst case (I think/hope not), this might even be problematic, because the result is written back to memory within the macros swap() and reverse(). Since the bug should be easy to fix, I'm looking forward to the appropriate commit. Best regards, Christian PS: I don't know who is responsible for this function, but it seems to be no standard ANSI/ISO C, but rather a BSD extension (according to the man pages at least). So I just checked the OpenBSD and FreeBSD web cvs and both showed this bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
文章代碼(AID): #1Bz2TaBD (FB_bugs)