libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / plugin / infoleak-fixit-1.c
blob56158c12520a804fc53ec9d36ad6839a387e2c8a
1 /* { dg-do compile } */
2 /* { dg-options "-fanalyzer" } */
3 /* { dg-require-effective-target analyzer } */
4 /* { dg-skip-if "structure layout assumption not met" { default_packed } } */
6 #include <string.h>
8 #include "test-uaccess.h"
10 typedef unsigned char u8;
11 typedef unsigned int u32;
13 struct st
15 u8 i; /* { dg-message "padding after field 'i' is uninitialized \\(3 bytes\\)" } */
16 u32 j; /* { dg-message "field 'j' is uninitialized \\(4 bytes\\)" } */
19 void test (void __user *dst, u8 a)
21 struct st s; /* { dg-message "region created on stack here" "where" } */
22 /* { dg-message "capacity: 8 bytes" "capacity" { target *-*-* } .-1 } */
23 /* { dg-message "suggest forcing zero-initialization by providing a '.0.' initializer" "fix-it hint" { target *-*-* } .-2 } */
24 s.i = a;
25 copy_to_user(dst, &s, sizeof (struct st)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
26 /* { dg-message "7 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */