ramosian-glider / memory-sanitizer

Automatically exported from code.google.com/p/memory-sanitizer
0 stars 0 forks source link

False positive with volatile bitfields #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
struct S {
  volatile unsigned x : 1;
} s;

void g() {
  s.x = 0;
}

compiles to:

%bf.load = load volatile i8* getelementptr inbounds (%struct.S* @s, i64 0, i32 
0), align 4
%bf.clear = and i8 %bf.load, -2
store volatile i8 %bf.clear, i8* getelementptr inbounds (%struct.S* @s, i64 0, 
i32 0), align 4

Sounds like we must allow volatile stores of uninitialized values. No way 
around it.

Tests could be rewritten to replace volatile assignments with either direct 
runtime calls, or something involving a branch instruction.

Original issue reported on code.google.com by euge...@google.com on 21 Jan 2013 at 4:32

GoogleCodeExporter commented 9 years ago
volatile stores of uninitialized data are allowed

Original comment by euge...@google.com on 16 May 2013 at 1:20

GoogleCodeExporter commented 9 years ago
Adding Project:MemorySanitizer as part of GitHub migration.

Original comment by gli...@google.com on 30 Jul 2015 at 9:22