gcc_builtin_overflow.c revision 1.1
1/* $NetBSD: gcc_builtin_overflow.c,v 1.1 2021/09/03 22:44:09 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 */ 12 13void 14is_overflow(void) 15{ 16 int sum; 17 18 /* expect+1: error: controlling expression must be bool, not 'int' [333] */ 19 if (__builtin_add_overflow(1, 2, &sum)) 20 return; 21 22 /* expect+1: error: controlling expression must be bool, not 'int' [333] */ 23 if (__builtin_add_overflow_p(1, 2, 12345)) 24 return; 25} 26