1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 int main () 5 { 6 char *foo; 7 8 __mf_set_options ("-check-initialization"); 9 foo = (char *)malloc (1); 10 11 /* These two operations each expand to a read-modify-write. 12 * Even though the end result is that every bit of foo[0] is 13 * eventually written to deterministically, the first read 14 * triggers an uninit error. Ideally, it shouldn't, so this 15 * should be treated more like a regular XFAIL. */ 16 foo[0] &= 0xfe; 17 foo[0] |= 0x01; 18 19 return foo[0]; 20 } 21 /* { dg-output "mudflap violation 1.*" } */ 22 /* { dg-output "Nearby object.*" } */ 23 /* { dg-output "mudflap object.*malloc region.*1r/0w.*" } */ 24 /* { dg-do run { xfail *-*-* } } */ 25