[lkml]   [2001]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [IDEA+RFC] Possible solution for min()/max() war

On Fri, 31 Aug 2001, Peter T. Breuer wrote:

> > What bug are you trying to fix here?
> Wake up!

I'm trying.

> Try reading the last 10 days kernel messages. The last 48 hours are
> particularly rewarding.

I have, but I only get the feeling, we're hunting here for imaginary bugs.
Real bugs could be found with -Wsign-compare, but nobody wants to use it
because our master doesn't want it...
Please define the bugs first, you're trying to fix! If you don't like
-Wsign-compare, consider defining rules for the Stanford checker. This way
you can check all compares and not just the few uses of min.

> C silently transforms signed int to unsigned int in cross-signed
> comparisons. This results in 1U < -2, and gives rise to all kinds
> of error paths from min/max codes (in particular, but they're not
> all) of the form

Care to give an example? For the cases I tried gcc gave a warning.

> Linus wants possible mistakes flagged. He specifically does not want
> -Wsign-compare because it apparently gives false positives.

diff -u -r1.1.1.23 Makefile
--- Makefile 16 Aug 2001 20:50:22 -0000
+++ Makefile 31 Aug 2001 11:15:21 -0000
@@ -87,7 +87,11 @@


-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
+WFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs
+WFLAGS := $(WFLAGS) -Wsign-compare
-fomit-frame-pointer -fno-strict-aliasing -fno-common

diff -u -r1.1.1.15
--- arch/i386/ 21 Jul 2001 12:48:20 -0000
+++ arch/i386/ 31 Aug 2001 11:12:56 -0000
@@ -390,4 +390,5 @@

#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Extra compile warnings' CONFIG_EXTRA_WARNINGS
diff -u -r1.1.1.23
--- Documentation/ 16 Aug 2001 20:55:53 -0000
+++ Documentation/ 31 Aug 2001 11:21:10 -0000
@@ -15766,6 +15766,15 @@
keys are documented in Documentation/sysrq.txt. Don't say Y unless
you really know what this hack does.

+Extra compile warnings
+ If you say Y here, the compilation will generate lots of extra
+ warnings. Some of them warn about constructions that users generally
+ do not consider questionable, but which occasionally you might wish
+ to check for; others warn about constructions that are necessary or
+ hard to avoid in some cases, and there is no simple way to modify the
+ code to suppress the warning. Unless you look for bugs, say N.
ISDN subsystem
ISDN ("Integrated Services Digital Networks", called RNIS in France)
bye, Roman

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:01    [W:0.083 / U:2.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site