lkml.org 
[lkml]   [1999]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] *(int*)0 = 0 & variations
Stefan Monnier wrote:
> Oh, yes it does: the compiler cannot always prove the code to be side-effect
> free, else

Sure, but almost all assertions are really simple tests, expressions
like `a != (b & FLAG_BIT) && (b != (b & OTHER_FLAG)' and so on. Those
are trivially side-effect free: there are no assignments or function
calls. The compiler can prove they're dead code.

There are more complicated assertions but I happen to think they're
either (a) rare, or (b) calls to consistency-checking functions which
can be stubbed for non-debug code anyway.

> the same analysis could be used to warn of improper use of assert.

It already detects when you have an expression with no side effects, and
can warn about it. It'd be nice to be able to reverse that -- get a
warning when an expression has side effects that it shouldn't.
Sometimes it would be wrong, just like it is for "use of uninitialised
variable", but that's not a terrible thing.

-- Jamie


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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