public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str)
@ 2015-10-28 11:58 d.v.a at ngs dot ru
  2015-10-28 20:52 ` [Bug libstdc++/68133] " daniel.kruegler at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: d.v.a at ngs dot ru @ 2015-10-28 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68133
           Summary: constexpr basic_string_view(const _CharT* __str)
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d.v.a at ngs dot ru
  Target Milestone: ---

Compilation of this code:

#include<experimental/string_view>

int main()
{
    int arr[std::experimental::string_view("s").length()];
}

produces error:

error: ISO C++ forbids variable length array 'arr' [-Wvla]


Constructor's implementation:

      constexpr basic_string_view(const _CharT* __str)
      : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
        _M_str{__str}
      { }

But traits_type::length() isn't constexpr


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

* [Bug libstdc++/68133] constexpr basic_string_view(const _CharT* __str)
  2015-10-28 11:58 [Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str) d.v.a at ngs dot ru
@ 2015-10-28 20:52 ` daniel.kruegler at googlemail dot com
  2015-10-29  6:02 ` d.v.a at ngs dot ru
  2015-10-31  6:38 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2015-10-28 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
The implementation matches the required semantics (see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4529.html). Please
note that std::char_traits::length is not constexpr because it is specified
that way and this is a known library issue, see

http://cplusplus.github.io/LWG/lwg-active.html#2232

The reason why the discussed string view constructor is nonetheless declared as
constexpr is due to the fact that a user *could* instantiate it with a
user-defined char trait class (not necessarily a specialization of
std::char_traits) that *has* a constexpr length function.

Based on this argumentation this issue looks invalid to me.
>From gcc-bugs-return-500852-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 28 21:12:51 2015
Return-Path: <gcc-bugs-return-500852-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 102652 invoked by alias); 28 Oct 2015 21:12:51 -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 101653 invoked by uid 48); 28 Oct 2015 21:12:47 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/68124] [6 Regression] Many i386 test failures
Date: Wed, 28 Oct 2015 21:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: WAITING
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-68124-4-E804lnqcaP@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-68124-4@http.gcc.gnu.org/bugzilla/>
References: <bug-68124-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-10/txt/msg02407.txt.bz2
Content-length: 2878

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

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Richard Henderson from comment #5)
> Works for me at r229501.
> 
> spawn -ignore SIGHUP /home/rth/gcc/bld/gcc/xgcc -B/home/rth/gcc/bld/gcc/
> /home/rth/gcc/git-master/gcc/testsuite/gcc.dg/vect/pr64421.c -mtune=corei7
> -fno-diagnostics-show-caret -fdiagnostics-color=never -msse2
> -ftree-vectorize -fno-vect-cost-model -fno-common -O2
> -fdump-tree-vect-details -fopenmp-simd -mavx -lm -o ./pr64421.exe
> PASS: gcc.dg/vect/pr64421.c (test for excess errors)

This particular test only fails with -m64:

[hjl@gnu-6 gcc]$ ./xgcc -B./   -S 
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/vect/pr64421.c 
-mtune=corei7 -fno-diagnostics-show-caret -fdiagnostics-color=never -msse2
-ftree-vectorize -fno-vect-cost-model -fno-common -O2 -fdump-tree-vect-details
-fopenmp-simd -mavx -lm -m32
[hjl@gnu-6 gcc]$ ./xgcc -B./   -S 
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/vect/pr64421.c 
-mtune=corei7 -fno-diagnostics-show-caret -fdiagnostics-color=never -msse2
-ftree-vectorize -fno-vect-cost-model -fno-common -O2 -fdump-tree-vect-details
-fopenmp-simd -mavx -lm -m64
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/vect/pr64421.c: In
function ‘*bar.simdclone.2’:
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/vect/pr64421.c:16:1:
internal compiler error: in gen_reg_rtx, at emit-rtl.c:1031
0x9a9877 gen_reg_rtx(machine_mode)
        /export/gnu/import/git/sources/gcc/gcc/emit-rtl.c:1031
0x9c9946 copy_to_reg(rtx_def*)
        /export/gnu/import/git/sources/gcc/gcc/explow.c:570
0xd3b5b2 gen_lowpart_general(machine_mode, rtx_def*)
        /export/gnu/import/git/sources/gcc/gcc/rtlhooks.c:62
0x1412d91 gen_split_392(rtx_insn*, rtx_def**)
        /export/gnu/import/git/sources/gcc/gcc/config/i386/sse.md:17100
0x15c0531 split_23
        /export/gnu/import/git/sources/gcc/gcc/config/i386/sse.md:17098
0x15c12ea split_24
        /export/gnu/import/git/sources/gcc/gcc/config/i386/i386.md:4803
0x15c4e52 split_insns(rtx_def*, rtx_insn*)
        /export/gnu/import/git/sources/gcc/gcc/config/i386/i386.md:15867
0x9afb29 try_split(rtx_def*, rtx_insn*, int)
        /export/gnu/import/git/sources/gcc/gcc/emit-rtl.c:3664
0xcd15d7 split_insn
        /export/gnu/import/git/sources/gcc/gcc/recog.c:2874
0xcd18af split_all_insns()
        /export/gnu/import/git/sources/gcc/gcc/recog.c:2964
0xcd36d3 rest_of_handle_split_after_reload
        /export/gnu/import/git/sources/gcc/gcc/recog.c:3900
0xcd3724 execute
        /export/gnu/import/git/sources/gcc/gcc/recog.c:3929
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-6 gcc]$
>From gcc-bugs-return-500853-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 28 21:13:05 2015
Return-Path: <gcc-bugs-return-500853-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 104185 invoked by alias); 28 Oct 2015 21:13:04 -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 104145 invoked by uid 48); 28 Oct 2015 21:13:00 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/68124] [6 Regression] Many i386 test failures
Date: Wed, 28 Oct 2015 21:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status
Message-ID: <bug-68124-4-uk0D86IBih@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-68124-4@http.gcc.gnu.org/bugzilla/>
References: <bug-68124-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-10/txt/msg02408.txt.bz2
Content-length: 285

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW


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

* [Bug libstdc++/68133] constexpr basic_string_view(const _CharT* __str)
  2015-10-28 11:58 [Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str) d.v.a at ngs dot ru
  2015-10-28 20:52 ` [Bug libstdc++/68133] " daniel.kruegler at googlemail dot com
@ 2015-10-29  6:02 ` d.v.a at ngs dot ru
  2015-10-31  6:38 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: d.v.a at ngs dot ru @ 2015-10-29  6:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from __vic <d.v.a at ngs dot ru> ---
Too much black magic in the library already...
I think this is defect in specification/design of the class. But it's easier
for you guys to reach the committee than for me


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

* [Bug libstdc++/68133] constexpr basic_string_view(const _CharT* __str)
  2015-10-28 11:58 [Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str) d.v.a at ngs dot ru
  2015-10-28 20:52 ` [Bug libstdc++/68133] " daniel.kruegler at googlemail dot com
  2015-10-29  6:02 ` d.v.a at ngs dot ru
@ 2015-10-31  6:38 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-31  6:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If you want that function to be constexpr you need to provide a custom traits
class.


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

end of thread, other threads:[~2015-10-31  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 11:58 [Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str) d.v.a at ngs dot ru
2015-10-28 20:52 ` [Bug libstdc++/68133] " daniel.kruegler at googlemail dot com
2015-10-29  6:02 ` d.v.a at ngs dot ru
2015-10-31  6:38 ` 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).