public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64867] split warning for passing non-POD to varargs function from -Wconditionally-supported into new warning flag, -Wnon-pod-varargs
Date: Fri, 03 Sep 2021 18:17:11 +0000	[thread overview]
Message-ID: <bug-64867-4-fq6iF2bixr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64867-4@http.gcc.gnu.org/bugzilla/>

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dcb314 at hotmail dot com

--- Comment #30 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Trass3r from comment #27)
> This should really be enabled by -Wall or -Wextra as it generates code that
> may easily crash or corrupt something.

+1.

Clang errors, intel warns and for gcc you have to enable the somewhat
obscure flag -Wconditionally-supported to see anything at all.

gcc looks to be a trailer on this issue. It's not about standards conformance,
its about making it easy for users to find bugs.

Source code I used is:

struct S
{
        S();
        S( const S &);
        ~S();

        char * p;
};

void f( int, ...);

void g()
{
        S s1;

        f( 3, s1);
};

$ /home/dcb/llvm/results/bin/clang++   sep3f.cc
sep3f.cc:19:8: error: cannot pass object of non-trivial type 'S' through
variadic function; call will abort at runtime [-Wnon-pod-varargs]
        f( 3, s1);
              ^
1 error generated.

$ /home/dcb34/intel/oneapi/compiler/2021.3.0/linux/bin/intel64/icpc  sep3f.cc
sep3f.cc(19): warning #1595: a class type that is not trivially copyable passed
through ellipsis
        f( 3, s1);
              ^

$ /home/dcb/gcc/results/bin/g++ -c -g -O2 -Wall -Wextra  sep3f.cc
$ /home/dcb/gcc/results/bin/g++ -c -g -O2 -Wall -Wextra
-Wconditionally-supported sep3f.cc
sep3f.cc: In function ‘void g()’:
sep3f.cc:19:10: warning: passing objects of non-trivially-copyable type ‘struct
S’ through ‘...’ is conditionally supported [-Wconditionally-supported]
   19 |         f( 3, s1);
      |         ~^~~~~~~~


I'll add flag -Wconditionally-supported to a build of Fedora and see
what happens.

  parent reply	other threads:[~2021-09-03 18:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 17:38 [Bug c++/64867] New: warning for passing non-POD to varargs function tromey at gcc dot gnu.org
2015-01-29 18:28 ` [Bug c++/64867] " pinskia at gcc dot gnu.org
2015-01-29 18:30 ` redi at gcc dot gnu.org
2015-01-29 18:31 ` jason at gcc dot gnu.org
2015-01-29 20:45 ` tromey at gcc dot gnu.org
2015-01-30 17:04 ` tromey at gcc dot gnu.org
2015-01-30 17:12 ` tromey at gcc dot gnu.org
2015-01-30 17:23 ` pinskia at gcc dot gnu.org
2015-01-30 17:26 ` pinskia at gcc dot gnu.org
2015-01-30 17:40 ` tromey at gcc dot gnu.org
2015-01-31  2:37 ` redi at gcc dot gnu.org
2015-02-02 19:38 ` tromey at gcc dot gnu.org
2017-09-05 14:11 ` rsandifo at gcc dot gnu.org
2021-09-03 18:17 ` dcb314 at hotmail dot com [this message]
2022-12-05 15:05 ` [Bug c++/64867] split warning for passing non-POD to varargs function from -Wconditionally-supported into new warning flag, -Wnon-pod-varargs jason at gcc dot gnu.org
2022-12-19 15:56 ` cvs-commit 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-64867-4-fq6iF2bixr@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).