public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic
@ 2013-11-06 20:00 marc.mutz at kdab dot com
  2013-11-07 11:51 ` [Bug libstdc++/59027] " daniel.kruegler at googlemail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: marc.mutz at kdab dot com @ 2013-11-06 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59027
           Summary: std::is_signed does not include check for
                    is_arithmetic
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marc.mutz at kdab dot com

According to N3797 Table 49, both is_signed and is_unsigned should evaluate to
true_type only if the argument is_arithmetic, too. is_unsigned honours this,
but is_signed doesn't:

  template<typename _Tp,
           bool = is_arithmetic<_Tp>::value>
    struct __is_signed_helper
    : public false_type { };

  template<typename _Tp>
    struct __is_signed_helper<_Tp, true>
    : public integral_constant<bool, _Tp(-1) < _Tp(0)>
    { };

  /// is_signed
  template<typename _Tp>
    struct is_signed
    : public __is_signed_helper<_Tp>::type
    { };

  /// is_unsigned
  template<typename _Tp>
    struct is_unsigned
    : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
    { };


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

* [Bug libstdc++/59027] std::is_signed does not include check for is_arithmetic
  2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
@ 2013-11-07 11:51 ` daniel.kruegler at googlemail dot com
  2013-11-07 13:13 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-11-07 11:51 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3644 bytes --]

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

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> ---
Can you provide a test that should fail according to your interpretation? I
think you are misreading the code: is_signed delegates to a specialization of
__is_signed_helper. For this template we have a static branch into types where
is_arithmetic doesn't hold (This returns false_type unconditionally) and
another one where this holds. Only in the latter case further performs the
additional expression test.
>From gcc-bugs-return-433826-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 07 11:52:41 2013
Return-Path: <gcc-bugs-return-433826-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30724 invoked by alias); 7 Nov 2013 11:52:41 -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 29675 invoked by uid 48); 7 Nov 2013 11:52:02 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/58994] asan.exp regressions on x86_64 darwin at -m64 but not -m32 at r204372
Date: Thu, 07 Nov 2013 11:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
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_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-58994-4-NSV4tykmgF@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58994-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58994-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: 2013-11/txt/msg00603.txt.bz2
Content-length: 913

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-07
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed on x86_64-apple-darwin13.

Revision 204368 says

Author:    kcc
Date:    Mon Nov 4 21:33:31 2013 UTC (2 days, 14 hours ago)
Log Message:
libsanitizer merge from upstream r191666

** This may break gcc-asan on Mac, will follow up separately. **

The failures are of the kind:

=p739=­dressSanitizer CHECK failed:
../../../../_clean/libsanitizer/sanitizer_common/sanitizer_mac.cc:146
"((env_ptr)) != (0)" (0x0, 0x0)


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

* [Bug libstdc++/59027] std::is_signed does not include check for is_arithmetic
  2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
  2013-11-07 11:51 ` [Bug libstdc++/59027] " daniel.kruegler at googlemail dot com
@ 2013-11-07 13:13 ` redi at gcc dot gnu.org
  2013-11-07 17:34 ` marc.mutz at kdab dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-07 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Marc Mutz from comment #0)
> 
>   template<typename _Tp,
>            bool = is_arithmetic<_Tp>::value>
                    ^^^^^^^^^^^^^^^^^^

>     struct __is_signed_helper
>     : public false_type { };
> 
>   template<typename _Tp>
>     struct __is_signed_helper<_Tp, true>
                                     ^^^^
>     : public integral_constant<bool, _Tp(-1) < _Tp(0)>
>     { };

This looks right to me.


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

* [Bug libstdc++/59027] std::is_signed does not include check for is_arithmetic
  2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
  2013-11-07 11:51 ` [Bug libstdc++/59027] " daniel.kruegler at googlemail dot com
  2013-11-07 13:13 ` redi at gcc dot gnu.org
@ 2013-11-07 17:34 ` marc.mutz at kdab dot com
  2013-11-07 17:46 ` daniel.kruegler at googlemail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marc.mutz at kdab dot com @ 2013-11-07 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Mutz <marc.mutz at kdab dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #3 from Marc Mutz <marc.mutz at kdab dot com> ---
See code posted in http://llvm.org/bugs/show_bug.cgi?id=17834
is_unsigned<MouseButton> fails, !is_signed succeeds. MouseButton is an enum.


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

* [Bug libstdc++/59027] std::is_signed does not include check for is_arithmetic
  2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
                   ` (2 preceding siblings ...)
  2013-11-07 17:34 ` marc.mutz at kdab dot com
@ 2013-11-07 17:46 ` daniel.kruegler at googlemail dot com
  2013-11-07 18:06 ` paolo.carlini at oracle dot com
  2013-11-07 18:43 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-11-07 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Marc Mutz from comment #3)
> See code posted in http://llvm.org/bugs/show_bug.cgi?id=17834
> is_unsigned<MouseButton> fails, !is_signed succeeds. MouseButton is an enum.

The assertion of the following code is required to hold according to the C++
library specification:

//---------------
#include <type_traits>

enum MouseButton {};

static_assert(!std::is_signed<MouseButton>::value, "");
//---------------

MouseButton is no arithmetic type therefore std::is_signed is required to
return false. If you are interested in the sign character of either the
underlying type or the promoted type of MouseButton, you have to perform
different tests, such as

static_assert(!std::is_signed<std::underlying_type<MouseButton>::type>::value,
"");
static_assert(std::is_signed<decltype(+MouseButton())>::value, "");

(The first result is currently unspecified by the standard)
>From gcc-bugs-return-433877-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 07 17:48:46 2013
Return-Path: <gcc-bugs-return-433877-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10362 invoked by alias); 7 Nov 2013 17:48:46 -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 10327 invoked by uid 48); 7 Nov 2013 17:48:43 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59039] Undocumented __builtin_longjmp/__builtin_setjmp
Date: Thu, 07 Nov 2013 17:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
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-59039-4-cMj1RRAazo@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59039-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59039-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: 2013-11/txt/msg00654.txt.bz2
Content-length: 563

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

--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Eric Botcazou from comment #12)
> No, __builtin_longjmp doesn't touch %rdi at all.  Don't worry too much, the
> SJLJ mechanism of the C++ and Ada compilers has been piggybacked on this for
> a couple of decades, this is quite robust.

This is good to hear.  What is each field?  I assume that
the first 3 fields are frame address, resume address and
stack address.  Are the same for all targets?  What are
the maximum number of fields?


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

* [Bug libstdc++/59027] std::is_signed does not include check for is_arithmetic
  2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
                   ` (3 preceding siblings ...)
  2013-11-07 17:46 ` daniel.kruegler at googlemail dot com
@ 2013-11-07 18:06 ` paolo.carlini at oracle dot com
  2013-11-07 18:43 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-07 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing again.


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

* [Bug libstdc++/59027] std::is_signed does not include check for is_arithmetic
  2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
                   ` (4 preceding siblings ...)
  2013-11-07 18:06 ` paolo.carlini at oracle dot com
@ 2013-11-07 18:43 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-07 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Marc Mutz from comment #0)
> According to N3797 Table 49, both is_signed and is_unsigned should evaluate
> to true_type only if the argument is_arithmetic, too. is_unsigned honours
> this, but is_signed doesn't:

Your own code shows this statement to be false. is_signed is false for your
enumeration type, as required. is_unsigned is also false, as required.

The text in your assertion is wrong:
static_assert(!std::is_signed<MouseButton>::value, "Enum should be unsigned");

It is not true that enums should be unsigned, the traits say enums are neither
signed nor unsigned, and that's what GCC does, as required:

#include <type_traits>
enum MouseButton { };
static_assert(!std::is_signed<MouseButton>::value,
              "Enum should be not be signed");
static_assert(!std::is_unsigned<MouseButton>::value,
              "Enum should not be unsigned");


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

end of thread, other threads:[~2013-11-07 18:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-06 20:00 [Bug libstdc++/59027] New: std::is_signed does not include check for is_arithmetic marc.mutz at kdab dot com
2013-11-07 11:51 ` [Bug libstdc++/59027] " daniel.kruegler at googlemail dot com
2013-11-07 13:13 ` redi at gcc dot gnu.org
2013-11-07 17:34 ` marc.mutz at kdab dot com
2013-11-07 17:46 ` daniel.kruegler at googlemail dot com
2013-11-07 18:06 ` paolo.carlini at oracle dot com
2013-11-07 18:43 ` 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).