public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/65901] New: no warning or error for va_arg (ap, void)
Date: Mon, 27 Apr 2015 12:48:00 -0000	[thread overview]
Message-ID: <bug-65901-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-04-27 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 12:48 vries at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65901-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).