[Bug c/67854] Missing diagnostic for passing bool to va_arg
slyfox at inbox dot ru
gcc-bugzilla@gcc.gnu.org
Tue Feb 23 09:22:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67854
Sergei Trofimovich <slyfox at inbox dot ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |slyfox at inbox dot ru
--- Comment #4 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Came up again in https://www.linux.org.ru/forum/development/12376493
The simplified test that which pre problem:
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
void func(va_list arg) {
_Bool value = __builtin_va_arg(
arg
//# 5 "a.c" 3 4
, _Bool);
(void)value;
}
$ gcc-5.3.0 -c -O2 -Wall -Wextra a.c
a.c: In function 'func':
a.c:8:21: warning: '_Bool' is promoted to 'int' when passed through '...'
, _Bool);
^
a.c:8:21: note: (so you should pass 'int' not '_Bool' to 'va_arg')
a.c:8:21: note: if this code is reached, the program will abort
If we uncomment line pragmas is stops working:
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
void func(va_list arg) {
_Bool value = __builtin_va_arg(
arg
# 5 "a.c" 3 4
, _Bool);
(void)value;
}
$ gcc-5.3.0 -c -O2 -Wall -Wextra a.c
No warning.
More information about the Gcc-bugs
mailing list