public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/56905] New: [C++11][DR 1130] std::copy_exception should be removed or no longer be used
@ 2013-04-10 13:55 daniel.kruegler at googlemail dot com
  2013-04-11 12:44 ` [Bug libstdc++/56905] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-04-10 13:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56905

             Bug #: 56905
           Summary: [C++11][DR 1130] std::copy_exception should be removed
                    or no longer be used
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


According to 

http://cplusplus.github.io/LWG/lwg-defects.html#1130

std::copy_exception has been replaced by std::make_exception_ptr. While I
understand that this function still exists for backward compatibility reasons
in libstdc++, I noticed that other places of the library (such as <future>)
still refer to std::copy_exception, which complicates a possible transition in
the future. I would recommend to replace all usages of std::copy_exception by
the library by std::make_exception_ptr. std::make_exception_ptr should be
defined independent of std::copy_exception. Personally I would recommend to
remove std::copy_exception, alternatively to define it in terms of
std::make_exception_ptr.


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

* [Bug libstdc++/56905] [C++11][DR 1130] std::copy_exception should be removed or no longer be used
  2013-04-10 13:55 [Bug libstdc++/56905] New: [C++11][DR 1130] std::copy_exception should be removed or no longer be used daniel.kruegler at googlemail dot com
@ 2013-04-11 12:44 ` redi at gcc dot gnu.org
  2013-04-11 13:20 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-04-11 12:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56905

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-11
     Ever Confirmed|0                           |1


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

* [Bug libstdc++/56905] [C++11][DR 1130] std::copy_exception should be removed or no longer be used
  2013-04-10 13:55 [Bug libstdc++/56905] New: [C++11][DR 1130] std::copy_exception should be removed or no longer be used daniel.kruegler at googlemail dot com
  2013-04-11 12:44 ` [Bug libstdc++/56905] " redi at gcc dot gnu.org
@ 2013-04-11 13:20 ` redi at gcc dot gnu.org
  2013-04-11 18:05 ` daniel.kruegler at googlemail dot com
  2013-04-24 22:05 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-04-11 13:20 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56905

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |redi at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-04-11 13:20:49 UTC ---
We might want to remove the copy_exception function entirely, to stop polluting
the namespace with it.


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

* [Bug libstdc++/56905] [C++11][DR 1130] std::copy_exception should be removed or no longer be used
  2013-04-10 13:55 [Bug libstdc++/56905] New: [C++11][DR 1130] std::copy_exception should be removed or no longer be used daniel.kruegler at googlemail dot com
  2013-04-11 12:44 ` [Bug libstdc++/56905] " redi at gcc dot gnu.org
  2013-04-11 13:20 ` redi at gcc dot gnu.org
@ 2013-04-11 18:05 ` daniel.kruegler at googlemail dot com
  2013-04-24 22:05 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-04-11 18:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56905

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-04-11 18:05:18 UTC ---
Here is my suggestion for a possible test, to be compiled with flags

-std=c++11 -Wall -W -pedantic

//-------------------------
#define copy_exception k42;
#include <exception>
#include <future>
//-------------------------

This code should be accepted, but chokes currently (as expected).
>From gcc-bugs-return-419858-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Apr 11 18:29:26 2013
Return-Path: <gcc-bugs-return-419858-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10589 invoked by alias); 11 Apr 2013 18:29:26 -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 10446 invoked by uid 48); 11 Apr 2013 18:29:22 -0000
From: "josh.m.conner at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/56924] New: Folding of checks into a range check should check upper boundary
Date: Thu, 11 Apr 2013 18:29:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: josh.m.conner at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56924-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01003.txt.bz2
Content-length: 1600


http://gcc.gnu.org/bugzilla/show_bug.cgi?idV924

             Bug #: 56924
           Summary: Folding of checks into a range check should check
                    upper boundary
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: josh.m.conner@gmail.com


When we are performing folding of checks into a range check, if the values are
at the top-end of the range we should just use a > test instead of normalizing
them into the bottom of the range and using a < test.

For example, consider:

  struct stype {
    unsigned int pad:4;
    unsigned int val:4;
  };

  void bar (void);

  void foo (struct stype input)
  {
    if ((input.val == 0xe) || (input.val == 0xf))
      bar();
  }


When compiled at -O2, the original tree generated is:


  ;; Function foo (null)
  ;; enabled by -tree-original


  {
    if (input.val + 2 <= 1)
      {
        bar ();
      }
  }

This is likely to be more efficient if we instead generate:

    if (input.val >= 0xe)
      {
        bar ();
      }

This can be seen in the inefficient codegen for an ARM cortex-a15:

        ubfx    r0, r0, #4, #4
        add     r3, r0, #2
        and     r3, r3, #15
        cmp     r3, #1

(the add and the and are not necessary if we change the test condition).

I was able to improve this by adding detection of this case into
build_range_check.


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

* [Bug libstdc++/56905] [C++11][DR 1130] std::copy_exception should be removed or no longer be used
  2013-04-10 13:55 [Bug libstdc++/56905] New: [C++11][DR 1130] std::copy_exception should be removed or no longer be used daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2013-04-11 18:05 ` daniel.kruegler at googlemail dot com
@ 2013-04-24 22:05 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-04-24 22:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56905

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-04-24 22:05:45 UTC ---
Fixed on trunk by the following commit.

Author: redi
Date: Wed Apr 24 22:00:16 2013
New Revision: 198265

URL: http://gcc.gnu.org/viewcvs?rev=198265&root=gcc&view=rev
Log:
    PR libstdc++/56905
    * libsupc++/exception_ptr.h (copy_exception): Deprecate and
    move implementation to make_exception_ptr.
    * include/std/future (_State_base::_M_break_promise): Replace
    copy_exception with make_exception_ptr.
    * testsuite/18_support/exception_ptr/move.cc: Likewise.
    * testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
    * testsuite/30_threads/future/members/get2.cc: Likewise.
    * testsuite/30_threads/promise/members/set_exception.cc: Likewise.
    * testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
    * testsuite/30_threads/promise/members/set_value2.cc: Likewise.
    * testsuite/30_threads/shared_future/members/get2.cc: Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/future
    trunk/libstdc++-v3/libsupc++/exception_ptr.h
    trunk/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc
    trunk/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
    trunk/libstdc++-v3/testsuite/30_threads/future/members/get2.cc
    trunk/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc
    trunk/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc
    trunk/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc
    trunk/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc


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

end of thread, other threads:[~2013-04-24 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 13:55 [Bug libstdc++/56905] New: [C++11][DR 1130] std::copy_exception should be removed or no longer be used daniel.kruegler at googlemail dot com
2013-04-11 12:44 ` [Bug libstdc++/56905] " redi at gcc dot gnu.org
2013-04-11 13:20 ` redi at gcc dot gnu.org
2013-04-11 18:05 ` daniel.kruegler at googlemail dot com
2013-04-24 22:05 ` redi 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).