[Bug c++/84551] New: [8 Regression] [concepts] Compiler options "-O -g" cause valid code to be rejected

reichelt at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Feb 25 13:57:00 GMT 2018


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

            Bug ID: 84551
           Summary: [8 Regression] [concepts] Compiler options "-O -g"
                    cause valid code to be rejected
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-fconcepts -g -O")
is wrongly rejected and triggers an ICE on trunk:

===================================================================
template<typename> concept bool C() { return true; }

template<template<typename T> requires C<T>() class> struct A {};

template<typename> requires true struct B {};

A<B> a;
===================================================================

bug.cc: In function 'concept bool C()':
bug.cc:1:33: error: definition of concept 'concept bool C()' has multiple
statements
 template<typename> concept bool C() { return true; }
                                 ^
bug.cc: At global scope:
bug.cc:7:4: internal compiler error: in non_atomic_constraint_p, at
cp/logic.cc:318
 A<B> a;
    ^
0x61694b non_atomic_constraint_p
        ../../gcc/gcc/cp/logic.cc:318
0x8dc3d0 any_p<std::_List_iterator<tree_node*>, bool (*)(tree_node*)>
        ../../gcc/gcc/cp/logic.cc:67
0x8dc3d0 any_non_atomic_constraints_p
        ../../gcc/gcc/cp/logic.cc:327
0x8dc3d0 analyze_atom
        ../../gcc/gcc/cp/logic.cc:359
0x8dc3d0 analyze_term
        ../../gcc/gcc/cp/logic.cc:468
0x8dc3d0 check_term
        ../../gcc/gcc/cp/logic.cc:495
0x8db5cf check_goal
        ../../gcc/gcc/cp/logic.cc:511
0x8db5cf check_proof
        ../../gcc/gcc/cp/logic.cc:537
0x8db5cf prove_implication
        ../../gcc/gcc/cp/logic.cc:754
0x8dc189 prove_implication
        ../../gcc/gcc/cp/logic.cc:731
0x8dc189 subsumes_constraints_nonnull
        ../../gcc/gcc/cp/logic.cc:786
0x8dc189 subsumes(tree_node*, tree_node*)
        ../../gcc/gcc/cp/logic.cc:803
0x97c336 is_compatible_template_arg
        ../../gcc/gcc/cp/pt.c:7571
0x97c336 convert_template_argument
        ../../gcc/gcc/cp/pt.c:7810
0x97a66b coerce_template_parms
        ../../gcc/gcc/cp/pt.c:8324
0x9738b6 lookup_template_class_1
        ../../gcc/gcc/cp/pt.c:8860
0x9738b6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/gcc/cp/pt.c:9209
0x9a35dd finish_template_type(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/semantics.c:3183
0x921034 cp_parser_template_id
        ../../gcc/gcc/cp/parser.c:15830
0x92113e cp_parser_class_name
        ../../gcc/gcc/cp/parser.c:22350
Please submit a full bug report, [etc.]

Without "-O" or "-g" the code is accepted.
The regression was introduced between 2017-11-26 and 2017-12-18.


More information about the Gcc-bugs mailing list