1 /* $NetBSD: gcc_builtin_overflow.c,v 1.3 2023/07/07 19:45:22 rillig Exp $ */ 2 # 3 "gcc_builtin_overflow.c" 3 4 /* 5 * Some GCC builtin functions return bool, and in lint's strict bool mode, 6 * that makes a difference. 7 * 8 * https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html 9 */ 10 11 /* lint1-extra-flags: -T -X 351 */ 12 13 void 14 is_overflow(void) 15 { 16 int sum; 17 18 if (__builtin_add_overflow(1, 2, &sum)) 19 return; 20 21 if (__builtin_add_overflow_p(1, 2, 12345)) 22 return; 23 24 /* expect+1: error: controlling expression must be bool, not 'int' [333] */ 25 if (__builtin_other(1, 2, 12345)) 26 return; 27 } 28