public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65901] New: no warning or error for va_arg (ap, void)
@ 2015-04-27 12:48 vries at gcc dot gnu.org
  2015-04-27 16:04 ` [Bug c/65901] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2015-04-27 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65901
           Summary: no warning or error for va_arg (ap, void)
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

We have va_arg (ap, void) somewhere in the testsuite
(gcc.c-torture/compile/pr48767.c).

AFAIU, using void in va_arg is undefined behaviour in c.

Currently, we just compile it without warning or error:
...
$ cat ~/va-arg-void.c
#include <stdarg.h>

int
f (int d, ...)
{
  int res;
  va_list ap;
  va_start (ap, d);
  va_arg (ap, void);
  res = va_arg (ap, int);  
  va_end (ap);
  return res;
}

int
main (void)
{
  return f (1, 2, 3);
}
$ gcc -O2 ~/va-arg-void.c
$ ./a.out ; echo $?
3
...

Btw, note that va_arg (ap, void) has an effect on ap.


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

end of thread, other threads:[~2015-04-28  8:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 12:48 [Bug c/65901] New: no warning or error for va_arg (ap, void) vries at gcc dot gnu.org
2015-04-27 16:04 ` [Bug c/65901] " mpolacek at gcc dot gnu.org
2015-04-28  8:37 ` mpolacek at gcc dot gnu.org
2015-04-28  8:37 ` 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).