[lkml]   [2005]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Do not misuse Coverity please (Was: sound/oss/cs46xx.c: fix a check after use)
Jean Delvare wrote:

> Wow. Great point. I completely missed that possibility. In fact I didn't
> know that the compiler could possibly alter the order of the
> instructions. For one thing, I thought it was simply not allowed to. For
> another, I didn't know that it had been made so aware that it could
> actually figure out how to do this kind of things. What a mess. Let's
> just hope that the gcc folks know their business :)
> I'll try to remember this next time I debug something. Do not assume
> that instructions are run in the order seen in the source. Irk.

It gets better, in that the cpus themselves can reorder instructions.
This becomes interesting when dealing with memory being shared between
multiple cpus on SMP machines. Either you need to use existing locking
primitives which enforce ordering or else you need to use explicit
cpu-level ordering instructions to ensure that data gets written/read in
the expected order. (See "mb" and friends in the kernel code.)

Then you get into potential caching issues with memory mapped at
different addresses on cpus with VIVT caches, and that introduces more

Computers are perfectly predictable, as long as you understand exactly
what you've told them to do...

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-04-06 13:31    [W:0.092 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site