public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67854] New: Missing diagnostic for passing bool to va_arg
@ 2015-10-05 17:15 miyuki at gcc dot gnu.org
  2015-10-20  8:58 ` [Bug c/67854] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-10-05 17:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67854

            Bug ID: 67854
           Summary: Missing diagnostic for passing bool to va_arg
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: miyuki at gcc dot gnu.org
  Target Milestone: ---

Consider the following code:

$ cat test.c
#include <stdarg.h>

void foo(va_list ap)
{
    va_arg(ap, char);
    va_arg(ap, unsigned char);
}

$ cc1 -std=c99 test.c 
In file included from test.c:1:0:
test.c: In function 'foo':
test.c:5:16: warning: 'char' is promoted to 'int' when passed through '...'
     va_arg(ap, char);
                ^
test.c:5:16: note: (so you should pass 'int' not 'char' to 'va_arg')
test.c:5:16: note: if this code is reached, the program will abort
test.c:6:16: warning: 'unsigned char' is promoted to 'int' when passed through
'...'
     va_arg(ap, unsigned char);
                ^
test.c:6:16: note: if this code is reached, the program will abort

However:

$ cat test2.c 
#include <stdbool.h>
#include <stdarg.h>

void foo(va_list ap)
{
    va_arg(ap, bool);
}

$ cc1 -std=c99 -Wall -Wextra test2.c

va_arg(ap, bool) is expanded into __builtin_trap, but no warning is issued.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/67854] Missing diagnostic for passing bool to va_arg
  2015-10-05 17:15 [Bug c/67854] New: Missing diagnostic for passing bool to va_arg miyuki at gcc dot gnu.org
@ 2015-10-20  8:58 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-20  8:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67854

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-20
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-20  8:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 17:15 [Bug c/67854] New: Missing diagnostic for passing bool to va_arg miyuki at gcc dot gnu.org
2015-10-20  8:58 ` [Bug c/67854] " mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).