public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
@ 2015-09-29 12:28 trippels at gcc dot gnu.org
  2015-09-29 13:50 ` [Bug c++/67762] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-29 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67762
           Summary: [C++1z] 'not a constant expression" errors only with
                    -fsanitize=undefined
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Created attachment 36415
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36415&action=edit
unreduced testcase

The attached testcase compiles fine without -fsanitize=undefined.

markus@x4 test % g++ -c -std=c++1z -Wall -Wextra variant.ii
markus@x4 test % g++ -c -fsanitize=undefined -std=c++1z -Wall -Wextra
variant.ii
/var/tmp/cmcstl2/test/variant.cpp: In function ‘void
{anonymous}::test_visit()’:
/var/tmp/cmcstl2/test/variant.cpp:886:5: error: non-constant condition for
static assertion
     static_assert(visit(f, V{42}, V{42}) == 84ull);
     ^
In file included from /var/tmp/cmcstl2/include/stl2/variant.hpp:30:0,
                 from /var/tmp/cmcstl2/test/variant.cpp:16:
/var/tmp/cmcstl2/test/variant.cpp:886:24:   in constexpr expansion of
‘std::experimental::ranges_v1::__variant::visit<std::plus<void>&,
{std::experimental::ranges_v1::variant
<int, unsigned int, long int, long unsigned int, long long int, long long
unsigned int>, std::experimental::ranges_v1::variant<int, unsigned int, long
int, long unsigned int,
 long long int, long long unsigned int>}>(f,
std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigned int>(42),
 std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigned int>(42))’
/var/tmp/cmcstl2/include/stl2/detail/variant/visit.hpp:414:32:   in constexpr
expansion of
‘std::experimental::ranges_v1::__variant::visit_with_indices<std::experimental::ran
ges_v1::__variant::no_index_visitor<std::plus<void>&>,
{std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigne
d int>, std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigned int>}>((*(UBSAN_NULL((&
std::experimental::ran
ges_v1::__variant::no_index_visitor<std::plus<void>&>{(*(UBSAN_NULL((&
std::forward<std::plus<void>&>((*(UBSAN_NULL((& f), 2u, 0u), (& f))))), 2u,
0u), (& std::forward<std::p
lus<void>&>((*(UBSAN_NULL((& f), 2u, 0u), (& f)))))))}), 2u, 8u), (&
std::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>{(*(UBSAN_NULL((&
std::forward
<std::plus<void>&>((*(UBSAN_NULL((& f), 2u, 0u), (& f))))), 2u, 0u), (&
std::forward<std::plus<void>&>((*(UBSAN_NULL((& f), 2u, 0u), (& f)))))))}))),
(*(UBSAN_NULL((& std::fo
rward<std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigned int> >((*(UBSAN_NULL((& vs#0),
2u, 8u), (& vs#0)
)))), 2u, 8u), (& std::forward<std::experimental::ranges_v1::variant<int,
unsigned int, long int, long unsigned int, long long int, long long unsigned
int> >((*(UBSAN_NULL((&
 vs#0), 2u, 8u), (& vs#0))))))), (*(UBSAN_NULL((&
std::forward<std::experimental::ranges_v1::variant<int, unsigned int, long int,
long unsigned int, long long int, long long 
unsigned int> >((*(UBSAN_NULL((& vs#1), 2u, 8u), (& vs#1))))), 2u, 8u), (&
std::forward<std::experimental::ranges_v1::variant<int, unsigned int, long int,
long unsigned int, 
long long int, long long unsigned int> >((*(UBSAN_NULL((& vs#1), 2u, 8u), (&
vs#1))))))))’
/var/tmp/cmcstl2/include/stl2/detail/variant/visit.hpp:388:36:   in constexpr
expansion of
‘std::experimental::ranges_v1::__variant::raw_visit_with_indices<std::experimental:
:ranges_v1::__variant::cooked_visitor<std::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>,
std::experimental::ranges_v1::variant<int, unsigned int, lo
ng int, long unsigned int, long long int, long long unsigned int>,
std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long l
ong unsigned int> >, {std::experimental::ranges_v1::variant<int, unsigned int,
long int, long unsigned int, long long int, long long unsigned int>,
std::experimental::ranges_
v1::variant<int, unsigned int, long int, long unsigned int, long long int, long
long unsigned int>}>((*(UBSAN_NULL((&
std::experimental::ranges_v1::__variant::cooked_visitor<
std::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>,
std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long i
nt, long long unsigned int>, std::experimental::ranges_v1::variant<int,
unsigned int, long int, long unsigned int, long long int, long long unsigned
int> >{(*(UBSAN_NULL((& s
td::forward<std::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>
>((*(UBSAN_NULL((& f), 2u, 8u), (& f))))), 2u, 8u), (&
std::forward<std::experimental:
:ranges_v1::__variant::no_index_visitor<std::plus<void>&> >((*(UBSAN_NULL((&
f), 2u, 8u), (& f)))))))}), 2u, 8u), (&
std::experimental::ranges_v1::__variant::cooked_visitor<s
td::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>,
std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long in
t, long long unsigned int>, std::experimental::ranges_v1::variant<int, unsigned
int, long int, long unsigned int, long long int, long long unsigned int>
>{(*(UBSAN_NULL((& st
d::forward<std::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>
>((*(UBSAN_NULL((& f), 2u, 8u), (& f))))), 2u, 8u), (&
std::forward<std::experimental::
ranges_v1::__variant::no_index_visitor<std::plus<void>&> >((*(UBSAN_NULL((& f),
2u, 8u), (& f)))))))}))), (*(UBSAN_NULL((&
std::forward<std::experimental::ranges_v1::variant<
int, unsigned int, long int, long unsigned int, long long int, long long
unsigned int> >((*(UBSAN_NULL((& vs#0), 2u, 8u), (& vs#0))))), 2u, 8u), (&
std::forward<std::experime
ntal::ranges_v1::variant<int, unsigned int, long int, long unsigned int, long
long int, long long unsigned int> >((*(UBSAN_NULL((& vs#0), 2u, 8u), (&
vs#0))))))), (*(UBSAN_NU
LL((& std::forward<std::experimental::ranges_v1::variant<int, unsigned int,
long int, long unsigned int, long long int, long long unsigned int>
>((*(UBSAN_NULL((& vs#1), 2u, 
8u), (& vs#1))))), 2u, 8u), (&
std::forward<std::experimental::ranges_v1::variant<int, unsigned int, long int,
long unsigned int, long long int, long long unsigned int> >((*(
UBSAN_NULL((& vs#1), 2u, 8u), (& vs#1))))))))’
/var/tmp/cmcstl2/include/stl2/detail/variant/visit.hpp:300:13: error:
‘(std::experimental::ranges_v1::__variant::o1_visit_handler<std::integer_sequence<long
unsigned int, 0ul
, 0ul>,
std::experimental::ranges_v1::__variant::cooked_visitor<std::experimental::ranges_v1::__variant::no_index_visitor<std::plus<void>&>,
std::experimental::ranges_v1::var
iant<int, unsigned int, long int, long unsigned int, long long int, long long
unsigned int>, std::experimental::ranges_v1::variant<int, unsigned int, long
int, long unsigned 
int, long long int, long long unsigned int> >,
{std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigned int>, 
std::experimental::ranges_v1::variant<int, unsigned int, long int, long
unsigned int, long long int, long long unsigned int>}> == 0u)’ is not a
constant expression
       STL2_CONSTEXPR_ASSUME(Dispatch::table[i]);
             ^
...
>From gcc-bugs-return-498294-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 29 12:54:44 2015
Return-Path: <gcc-bugs-return-498294-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24472 invoked by alias); 29 Sep 2015 12:54:43 -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 19397 invoked by uid 55); 29 Sep 2015 12:54:38 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/65393] std::thread shared_ptr inefficiency
Date: Tue, 29 Sep 2015 12:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65393-4-7ImpVmDiq2@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65393-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65393-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/msg02272.txt.bz2
Content-length: 1283

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Sep 29 12:54:05 2015
New Revision: 228242

URL: https://gcc.gnu.org/viewcvs?rev"8242&root=gcc&view=rev
Log:
Reduce space and time overhead of std::thread

        PR libstdc++/65393
        * config/abi/pre/gnu.ver: Export new symbols.
        * include/std/thread (thread::_State, thread::_State_impl): New types.
        (thread::_M_start_thread): Add overload taking unique_ptr<_State>.
        (thread::_M_make_routine): Remove.
        (thread::_S_make_state): Add.
        (thread::_Impl_base, thread::_Impl, thread::_M_start_thread)
        [_GLIBCXX_THREAD_ABI_COMPAT] Only declare conditionally.
        * src/c++11/thread.cc (execute_native_thread_routine): Rename to
        execute_native_thread_routine_compat and re-define to use _State.
        (thread::_State::~_State()): Define.
        (thread::_M_make_thread): Define new overload.
        (thread::_M_make_thread) [_GLIBCXX_THREAD_ABI_COMPAT]: Only define old
        overloads conditionally.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/config/abi/pre/gnu.ver
    trunk/libstdc++-v3/include/std/thread
    trunk/libstdc++-v3/src/c++11/thread.cc


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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
@ 2015-09-29 13:50 ` mpolacek at gcc dot gnu.org
  2015-09-29 14:11 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-09-29 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-29
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  I'll reduce this to something more usable.

Note that I get ICE with gcc-5:

In file included from /var/tmp/cmcstl2/include/stl2/type_traits.hpp:16:0,
                 from /var/tmp/cmcstl2/test/variant.cpp:15:
/var/tmp/cmcstl2/include/stl2/detail/fwd.hpp:47:5: error: ‘requires’ does not
name a type
In file included from /var/tmp/cmcstl2/include/stl2/type_traits.hpp:18:0,
                 from /var/tmp/cmcstl2/test/variant.cpp:15:
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:24:3: error: ‘concept’
does not name a type
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:27:3: error: ‘concept’
does not name a type
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:30:3: error: ‘concept’
does not name a type
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:33:3: error: ‘concept’
does not name a type
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:42:5: error: ‘concept’
does not name a type
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:55:32: error:
‘std::experimental::ranges_v1::detail::_Same’ has not been declared
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:55:37: error: expected
‘>’ before ‘<’ token
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:56:28: error: ‘Rest’ was
not declared in this scope
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:56:32: error: expected
parameter pack before ‘...’
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:56:20: error: template
argument 2 is invalid
/var/tmp/cmcstl2/include/stl2/detail/concepts/core.hpp:56:20: internal compiler
error: tree check: expected tree_vec, have error_mark in
get_innermost_template_args, at cp/pt.c:595
0xf2bdac tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/marek/src/gcc/gcc/tree.c:9297
0x652619 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/marek/src/gcc/gcc/tree.h:2851
0x652619 get_innermost_template_args(tree_node*, int)
        /home/marek/src/gcc/gcc/cp/pt.c:595
0x6a23e3 process_partial_specialization
        /home/marek/src/gcc/gcc/cp/pt.c:4148
0x6a4467 push_template_decl_real(tree_node*, bool)
        /home/marek/src/gcc/gcc/cp/pt.c:4907
0x640104 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        /home/marek/src/gcc/gcc/cp/decl.c:4839
0x735afd cp_parser_init_declarator
        /home/marek/src/gcc/gcc/cp/parser.c:17195
0x736702 cp_parser_single_declaration
        /home/marek/src/gcc/gcc/cp/parser.c:23850
0x7369b8 cp_parser_template_declaration_after_export
        /home/marek/src/gcc/gcc/cp/parser.c:23641
0x73bf19 cp_parser_declaration
        /home/marek/src/gcc/gcc/cp/parser.c:11343
0x73a41a cp_parser_declaration_seq_opt
        /home/marek/src/gcc/gcc/cp/parser.c:11265
0x73ac95 cp_parser_namespace_body
        /home/marek/src/gcc/gcc/cp/parser.c:16293
0x73ac95 cp_parser_namespace_definition
        /home/marek/src/gcc/gcc/cp/parser.c:16274
0x73be79 cp_parser_declaration
        /home/marek/src/gcc/gcc/cp/parser.c:11367
0x73a41a cp_parser_declaration_seq_opt
        /home/marek/src/gcc/gcc/cp/parser.c:11265
0x73ac95 cp_parser_namespace_body
        /home/marek/src/gcc/gcc/cp/parser.c:16293
0x73ac95 cp_parser_namespace_definition
        /home/marek/src/gcc/gcc/cp/parser.c:16274
0x73be79 cp_parser_declaration
        /home/marek/src/gcc/gcc/cp/parser.c:11367
0x73a41a cp_parser_declaration_seq_opt
        /home/marek/src/gcc/gcc/cp/parser.c:11265
0x73ac95 cp_parser_namespace_body
        /home/marek/src/gcc/gcc/cp/parser.c:16293
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.
>From gcc-bugs-return-498313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 29 13:51:28 2015
Return-Path: <gcc-bugs-return-498313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 38587 invoked by alias); 29 Sep 2015 13:51:28 -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 38530 invoked by uid 48); 29 Sep 2015 13:51:19 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/67766] New: [6 Regression]: Bootstrap failure on alpha-linux-gnu: ICE in simplify_subreg, at simplify-rtx.c
Date: Tue, 29 Sep 2015 13:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ubizjak at gmail dot com
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 cc target_milestone cf_gcctarget attachments.created
Message-ID: <bug-67766-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-09/txt/msg02291.txt.bz2
Content-length: 4936

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

            Bug ID: 67766
           Summary: [6 Regression]: Bootstrap failure on alpha-linux-gnu:
                    ICE in simplify_subreg, at simplify-rtx.c
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
                CC: aoliva at gcc dot gnu.org
  Target Milestone: ---
            Target: alpha-linux-gnu

Created attachment 36416
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36416&action=edit
Preprocessed testcase

alpha-linux-gnu bootstrap is currently broken due to r228175:

2015-09-27  Alexandre Oliva <aoliva@redhat.com>

        PR rtl-optimization/64164
        PR tree-optimization/67312
        PR middle-end/67340
        PR middle-end/67490
        PR bootstrap/67597
        * cfgexpand.c (parm_in_stack_slot_p): Remove.
        (ssa_default_def_partition): Remove.
        (get_rtl_for_parm_ssa_default_def): Remove.
        (set_rtl): Check that RTL assignments match expectations.
        Loop on SUBREGs, CONCATs and PARALLELs subexprs.  Set only the
        default def location for params and results.  Record SSA names
        or types in REG and MEM attrs, respectively.
        ...

The ICE can be reproduced with a crosscompiler from x86_64-linux-gnu to
alpha-linux-gnu, configured with: --target=alpha-linux-gnu --enable-languages=c
--with-long-double-128

~/gcc-build-alpha/gcc/cc1 -O2 -quiet -fpreprocessed -o libgcc2.o libgcc2.i
/space/homedirs/uros/gcc-svn/trunk/libgcc/libgcc2.c: In function ‘__mulsc3’:
/space/homedirs/uros/gcc-svn/trunk/libgcc/libgcc2.c:1992:1: internal compiler
error: in simplify_subreg, at simplify-rtx.c:5807
0xa50bb0 simplify_subreg(machine_mode, rtx_def*, machine_mode, unsigned int)
        ../../gcc-svn/trunk/gcc/simplify-rtx.c:5807
0xa5104c simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned
int)
        ../../gcc-svn/trunk/gcc/simplify-rtx.c:6031
0xa1a494 gen_lowpart_general(machine_mode, rtx_def*)
        ../../gcc-svn/trunk/gcc/rtlhooks.c:54
0x7885cf convert_move(rtx_def*, rtx_def*, int)
        ../../gcc-svn/trunk/gcc/expr.c:581
0x7e6edd expand_function_end()
        ../../gcc-svn/trunk/gcc/function.c:5461
0x67c669 construct_exit_block
        ../../gcc-svn/trunk/gcc/cfgexpand.c:5820
0x67c669 execute
        ../../gcc-svn/trunk/gcc/cfgexpand.c:6326
Please submit a full bug report,
[...]

gdb session:

Breakpoint 1, internal_error (gmsgid=0x11f6cd5 "in %s, at %s:%d") at
../../gcc-svn/trunk/gcc/diagnostic.c:1134
1134    internal_error (const char *gmsgid, ...)
(gdb) bt
#0  internal_error (gmsgid=0x11f6cd5 "in %s, at %s:%d") at
../../gcc-svn/trunk/gcc/diagnostic.c:1134
#1  0x000000000102091c in fancy_abort (file=<optimized out>, line=5807, 
    function=0x1121860 <simplify_subreg(machine_mode, rtx_def*, machine_mode,
unsigned int)::__FUNCTION__> "simplify_subreg")
    at ../../gcc-svn/trunk/gcc/diagnostic.c:1209
#2  0x0000000000a50bb1 in simplify_subreg (outermode=VOIDmode,
op=0x2aaaaeae4d20, innermode=SCmode, byte=0)
    at ../../gcc-svn/trunk/gcc/simplify-rtx.c:5807
#3  0x0000000000a5104d in simplify_gen_subreg (outermode=18836693, 
    op=0x1121860 <simplify_subreg(machine_mode, rtx_def*, machine_mode,
unsigned int)::__FUNCTION__>, innermode=17959616, byte=5807)
    at ../../gcc-svn/trunk/gcc/simplify-rtx.c:6031
#4  0x0000000000a1a495 in gen_lowpart_general (mode=VOIDmode, x=0x2aaaaeae4d20)
at ../../gcc-svn/trunk/gcc/rtlhooks.c:54
#5  0x00000000007885d0 in convert_move (to=0x2aaaaea95df0, from=<optimized
out>, unsignedp=0) at ../../gcc-svn/trunk/gcc/expr.c:581
#6  0x00000000007e6ede in expand_function_end () at
../../gcc-svn/trunk/gcc/function.c:5461
#7  0x000000000067c66a in construct_exit_block () at
../../gcc-svn/trunk/gcc/cfgexpand.c:5820
#8  (anonymous namespace)::pass_expand::execute (this=<optimized out>,
fun=0x2aaaaea8b348) at ../../gcc-svn/trunk/gcc/cfgexpand.c:6326

convert_move tries to generate a VOIDmode subreg:

(gdb) f 5
#5  0x00000000007885d0 in convert_move (to=0x2aaaaea95df0, from=<optimized
out>, unsignedp=0) at ../../gcc-svn/trunk/gcc/expr.c:581
581           emit_move_insn (to, gen_lowpart (to_mode, from));
(gdb) p debug_rtx (to)
(parallel/i [
        (expr_list:REG_DEP_TRUE (reg:SF 32 $f0)
            (const_int 0 [0]))
        (expr_list:REG_DEP_TRUE (reg:SF 33 $f1)
            (const_int 4 [0x4]))
    ])
$4 = void
(gdb) f 4
#4  0x0000000000a1a495 in gen_lowpart_general (mode=VOIDmode, x=0x2aaaaeae4d20)
at ../../gcc-svn/trunk/gcc/rtlhooks.c:54
54        rtx result = gen_lowpart_common (mode, x);
(gdb) p mode
$5 = VOIDmode
(gdb) p debug_rtx (x)
(concat:SC (reg:SF 608)
    (reg:SF 609))
$6 = void
>From gcc-bugs-return-498314-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 29 14:04:49 2015
Return-Path: <gcc-bugs-return-498314-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 68583 invoked by alias); 29 Sep 2015 14:04:48 -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 68487 invoked by uid 48); 29 Sep 2015 14:04:43 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
Date: Tue, 29 Sep 2015 14:04: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: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
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-67762-4-mcBzEFJyiJ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67762-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67762-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/msg02292.txt.bz2
Content-length: 258

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The compile-time error goes away when adding
-fno-sanitize=null,returns-nonnull-attribute,nonnull-attribute to the
command-line options.


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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
  2015-09-29 13:50 ` [Bug c++/67762] " mpolacek at gcc dot gnu.org
@ 2015-09-29 14:11 ` mpolacek at gcc dot gnu.org
  2015-09-29 14:22 ` trippels at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-09-29 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Not reducing anymore; creduce dies for me :(.


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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
  2015-09-29 13:50 ` [Bug c++/67762] " mpolacek at gcc dot gnu.org
  2015-09-29 14:11 ` mpolacek at gcc dot gnu.org
@ 2015-09-29 14:22 ` trippels at gcc dot gnu.org
  2015-09-29 17:02 ` trippels at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-29 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> Not reducing anymore; creduce dies for me :(.

Yes, I was unsuccessful in reducing it with creduce, too.
(Well, clang doesn't support C++ concepts yet, so perhaps it is not
too surprising.)


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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-09-29 14:22 ` trippels at gcc dot gnu.org
@ 2015-09-29 17:02 ` trippels at gcc dot gnu.org
  2015-09-29 19:25 ` trippels at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-29 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #36415|0                           |1
        is obsolete|                            |

--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Created attachment 36417
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36417&action=edit
Somewhat reduced testcase

C-Reduce 2.4.0 was released yesterday, which doesn't crash anymore.
Somewhat reduced testcase attached.


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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-09-29 17:02 ` trippels at gcc dot gnu.org
@ 2015-09-29 19:25 ` trippels at gcc dot gnu.org
  2021-04-27 23:57 ` dushistov at mail dot ru
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-29 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #36417|0                           |1
        is obsolete|                            |

--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Created attachment 36418
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36418&action=edit
Somewhat reduced testcase


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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-09-29 19:25 ` trippels at gcc dot gnu.org
@ 2021-04-27 23:57 ` dushistov at mail dot ru
  2021-11-10 13:03 ` curdeius at gmail dot com
  2022-12-31 21:44 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: dushistov at mail dot ru @ 2021-04-27 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Evgeniy Dushistov <dushistov at mail dot ru> ---
Here simple example extracted from Qt 6 git:

```
template<auto Signal=nullptr>
struct Prop {
    void notify()
    {
            if constexpr (Signal != nullptr) {
            }
    }
};

class QObjectPrivate {
public:
    struct ExtraData
    {
            inline void nameChangedForwarder()  {}
    };
};

int main()
{
        Prop<&QObjectPrivate::ExtraData::nameChangedForwarder>  prop;
        prop.notify();
}

```

"g++ -std=c++17" compiles it just fine,
while "g++ -std=c++17 -fsanitize=undefined" gitves such error:

test2.cpp: In instantiation of 'void Prop<Signal>::notify() [with auto Signal =
&QObjectPrivate::ExtraData::nameChangedForwarder]':
test2.cpp:21:13:   required from here
test2.cpp:5:34: error: '(QObjectPrivate::ExtraData::nameChangedForwarder != 0)'
is not a constant expression
    5 |             if constexpr (Signal != nullptr) {
      |                           ~~~~~~~^~~~~~~~~~


This is with gcc 11.1.0

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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-04-27 23:57 ` dushistov at mail dot ru
@ 2021-11-10 13:03 ` curdeius at gmail dot com
  2022-12-31 21:44 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: curdeius at gmail dot com @ 2021-11-10 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Curdeius Curdeius <curdeius at gmail dot com> ---
A different (rather small) reproduce.
https://godbolt.org/z/bz9sTd34o

It fails with all the versions of gcc from at least 7 (the above code needs
`auto` in template non-type parameter) to trunk from 2021-11-10.

Hope it helps!

```
#include <date/date.h>

#include <chrono>
#include <functional>

namespace detail {

static inline void validate(date::weekday v) noexcept {
    (void)v;
    assert(v.ok());
}

template <typename Duration, auto InitValue, auto GetValue = nullptr>
struct date_interval {
    using duration_type = Duration;

    duration_type begin{InitValue};

    [[nodiscard]] constexpr auto begin_value() const noexcept {
        if constexpr (GetValue != nullptr) {
            return std::invoke(GetValue, begin);
        } else {
            return begin;
        }
    }
};

}  // namespace detail

using days_interval = detail::date_interval<date::weekday, /*date::Sunday*/ 7,
                                            &date::weekday::c_encoding>;

int main() {
    days_interval days;
    return (int)days.begin_value();
}
```

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

* [Bug c++/67762] [C++1z] 'not a constant expression" errors only with -fsanitize=undefined
  2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-11-10 13:03 ` curdeius at gmail dot com
@ 2022-12-31 21:44 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-31 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Even though PR 71962 is reported after this bug, the comments has more analysis
of what is going on so closing as a dup.

*** This bug has been marked as a duplicate of bug 71962 ***

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

end of thread, other threads:[~2022-12-31 21:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 12:28 [Bug c++/67762] New: [C++1z] 'not a constant expression" errors only with -fsanitize=undefined trippels at gcc dot gnu.org
2015-09-29 13:50 ` [Bug c++/67762] " mpolacek at gcc dot gnu.org
2015-09-29 14:11 ` mpolacek at gcc dot gnu.org
2015-09-29 14:22 ` trippels at gcc dot gnu.org
2015-09-29 17:02 ` trippels at gcc dot gnu.org
2015-09-29 19:25 ` trippels at gcc dot gnu.org
2021-04-27 23:57 ` dushistov at mail dot ru
2021-11-10 13:03 ` curdeius at gmail dot com
2022-12-31 21:44 ` pinskia 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).