1 #include "check_debug.h" 2 3 void memcpy(void *dest, void *src, int size); 4 void memset(void *dest, char c, int size); 5 6 7 struct foo { 8 int x, y; 9 }; 10 11 void test(void) 12 { 13 struct foo src = {1, 41}; 14 struct foo dest; 15 16 memcpy(&dest, &src, sizeof(dest)); 17 __smatch_implied(dest.x + dest.y); 18 memset(&dest, 0, sizeof(dest)); 19 __smatch_implied(dest.x + dest.y); 20 21 } 22 23 /* 24 * check-name: smatch struct assignment #1 25 * check-command: smatch -I.. sm_struct_assign1.c 26 * 27 * check-output-start 28 sm_struct_assign1.c:17 test() implied: dest.x + dest.y = '42' 29 sm_struct_assign1.c:19 test() implied: dest.x + dest.y = '0' 30 * check-output-end 31 */ 32