public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102488] New: ICE with default constexpr operator== on class with bitfield
@ 2021-09-26 10:34 luc.briand35 at gmail dot com
  2021-09-27 11:37 ` [Bug c++/102488] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: luc.briand35 at gmail dot com @ 2021-09-26 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102488
           Summary: ICE with default constexpr operator== on class with
                    bitfield
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luc.briand35 at gmail dot com
  Target Milestone: ---

Hello,

The following code causes an ICE, the culprit being the constexpr operator==.
This only happens on the trunk version (12.0) of gcc.
When the bitfield is smaller than 8 bits, there is no crash.

Godbolt link: https://gcc.godbolt.org/z/eh57da3cE


struct A 
{
    unsigned int a : 8; /* no crash for sizes from 1 to 7 and 32 */

    constexpr bool operator==(const A&) const = default;
};


int main()
{
    A a{}, b{};

    return a == b;
}


Full error message (command: "gcc -c ./test_bug.cpp -std=c++2a"):


./test_bug.cpp: In member function ‘constexpr bool A::operator==(const A&)
const’:
./test_bug.cpp:7:20: error: type mismatch in ‘component_ref’
    7 |     constexpr bool operator==(const A&) const = default;
      |                    ^~~~~~~~
unsigned int

unsigned char

_1 = this->a;
./test_bug.cpp:7:20: error: type mismatch in ‘component_ref’
unsigned int

unsigned char

_2 = D.2080->a;
./test_bug.cpp:7:20: internal compiler error: ‘verify_gimple’ failed
0x100bd2d verify_gimple_in_seq(gimple*)
        ../../gcc-trunk/gcc/tree-cfg.c:5097
0xd40216 gimplify_body(tree_node*, bool)
        ../../gcc-trunk/gcc/gimplify.c:14876
0xd403f3 gimplify_function_tree(tree_node*)
        ../../gcc-trunk/gcc/gimplify.c:14966
0xb88907 cgraph_node::analyze()
        ../../gcc-trunk/gcc/cgraphunit.c:669
0xb8b44f analyze_functions
        ../../gcc-trunk/gcc/cgraphunit.c:1210
0xb8c032 symbol_table::finalize_compilation_unit()
        ../../gcc-trunk/gcc/cgraphunit.c:2956
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/102488] ICE with default constexpr operator== on class with bitfield
  2021-09-26 10:34 [Bug c++/102488] New: ICE with default constexpr operator== on class with bitfield luc.briand35 at gmail dot com
@ 2021-09-27 11:37 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-27 11:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The ICE only happens with checking but the problem is the same.

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

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

end of thread, other threads:[~2021-09-27 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 10:34 [Bug c++/102488] New: ICE with default constexpr operator== on class with bitfield luc.briand35 at gmail dot com
2021-09-27 11:37 ` [Bug c++/102488] " 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).