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-unsubscr...@freebsd.org"

Reply via email to