public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67559] New: [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error
@ 2015-09-12 18:35 bisqwit at iki dot fi
  2015-09-13 16:58 ` [Bug c++/67559] " daniel.kruegler at googlemail dot com
  2015-09-13 20:13 ` bisqwit at iki dot fi
  0 siblings, 2 replies; 3+ messages in thread
From: bisqwit at iki dot fi @ 2015-09-12 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67559
           Summary: [C++] [regression] Passing non-trivially copyable
                    objects through '...' doesn't generate warning or
                    error
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

In GCC 4.9, this code generates an error. In GCC 5.2, it generates no warning
or error, even on -Wall -Wextra -pedantic.

    struct test { test(){} ~test(){} };
    void a(int, ...) {}
    int main()
    {
        test object;
        a(5, object);
    }

Tried different standards modes: -std=c++98, -std=c++03, -std=c++11, -std=c++14

Tried also lambda functions with variadic args, same result.

The error message in GCC 4.9 (and earier down to 4.6) was:

    cannot pass objects of non-trivially-copyable type 'struct test' through
'...'

In GCC 5.2, no error or warning message is given in any of the standard modes.
In the standard version C++03, this behavior is undefined (§5.2.2/7). In C++11,
it is conditionally supported with implementation-defined semantics.
>From gcc-bugs-return-497055-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 12 18:53:25 2015
Return-Path: <gcc-bugs-return-497055-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27498 invoked by alias); 12 Sep 2015 18:53:25 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27447 invoked by uid 48); 12 Sep 2015 18:53:19 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/67540] string_intrinsics_inc.c sanitizer detects null pointer passed to memcpy
Date: Sat, 12 Sep 2015 18:53:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libfortran
X-Bugzilla-Version: 5.2.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-67540-4-oIv5waWe9m@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67540-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67540-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01033.txt.bz2
Content-length: 324

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg540

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> If you had a sanitized version of libgfortran you could check them by yourself.

Could you please post the exact command line you are using for configure and
make and, if needed, the environment?


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

* [Bug c++/67559] [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error
  2015-09-12 18:35 [Bug c++/67559] New: [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error bisqwit at iki dot fi
@ 2015-09-13 16:58 ` daniel.kruegler at googlemail dot com
  2015-09-13 20:13 ` bisqwit at iki dot fi
  1 sibling, 0 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2015-09-13 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
According the release notes of gcc 5 (https://gcc.gnu.org/gcc-5/changes.html)
this is by design:

"G++ now allows passing a non-trivially-copyable class via C varargs, which is
conditionally-supported with implementation-defined semantics in the standard.
This uses the same calling convention as a normal value parameter."

and as you already note this behaviour is supported by the C++11 standard.
>From gcc-bugs-return-497122-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Sep 13 18:32:20 2015
Return-Path: <gcc-bugs-return-497122-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20997 invoked by alias); 13 Sep 2015 18:32:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20964 invoked by uid 48); 13 Sep 2015 18:32:16 -0000
From: "forest_software at mail dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/67566] New: <string> std::move is in global scope g++ 5.1 -std=c++14
Date: Sun, 13 Sep 2015 18:32:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: forest_software at mail dot ru
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-67566-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01100.txt.bz2
Content-length: 736

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg566

            Bug ID: 67566
           Summary: <string> std::move is in global scope g++ 5.1
                    -std=c++14
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: forest_software at mail dot ru
  Target Milestone: ---

std::move is in global scope after #include <string>, conflict with boost::move

example:

main.cpp:

#include <string>
#include <boost/move/move.hpp>

using boost::move;

main()
{
  std::string a = "fff";
  std::string b = move(a);
}

Compile:

g++ main.cpp -std=c++14


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

* [Bug c++/67559] [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error
  2015-09-12 18:35 [Bug c++/67559] New: [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error bisqwit at iki dot fi
  2015-09-13 16:58 ` [Bug c++/67559] " daniel.kruegler at googlemail dot com
@ 2015-09-13 20:13 ` bisqwit at iki dot fi
  1 sibling, 0 replies; 3+ messages in thread
From: bisqwit at iki dot fi @ 2015-09-13 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Joel Yliluoma <bisqwit at iki dot fi> ---
But when compiling for earlier standard versions that explicitly label this as
undefined behavior, it should at least give a warning.


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

end of thread, other threads:[~2015-09-13 20:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-12 18:35 [Bug c++/67559] New: [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error bisqwit at iki dot fi
2015-09-13 16:58 ` [Bug c++/67559] " daniel.kruegler at googlemail dot com
2015-09-13 20:13 ` bisqwit at iki dot fi

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).