public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98043] New: (Regression) ICE in verify_gimpl due to bitpacked enum class (amd64)
@ 2020-11-28 13:54 BenWiederhake.GitHub at gmx dot de
  2020-11-30  8:07 ` [Bug c++/98043] " rguenth at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: BenWiederhake.GitHub at gmx dot de @ 2020-11-28 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98043
           Summary: (Regression) ICE in verify_gimpl due to bitpacked enum
                    class (amd64)
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: BenWiederhake.GitHub at gmx dot de
  Target Milestone: ---

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

Compiling the following code crashes g++-10 and g++-11, but not g++-9:

    // g++ -std=c++2a -o /tmp/example.cpp.o -c example.cpp
    enum class MyEnumClass { A };
    struct MyClass {
        MyEnumClass foobar : 8 { MyEnumClass::A };
    };
    bool some_function(MyClass x)
    {
        switch (x.foobar) {
        case MyEnumClass::A:
            return false;
        }
    }

See at the bottom the exact invocation, error messages, and g++ versions.

The enum-class, bit-packing, the seemingly incomplete switch-case, non-constant
switch-argument, all seem to be necessary to trigger the bug.

This bug seems very similar to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97634 , but it's a different
platform. Feel free to merge if it's the same bug.

* What was the outcome of this action?

Compiler crash (error message see below)

* What outcome did you expect instead?

Either a successful compilation, or a compilation error; but not a compiler
crash.


Full error message and versions:

$ /usr/bin/g++-9 --version
g++-9 (Debian 9.3.0-18) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/bin/g++-9 -std=c++2a -o /tmp/example.cpp.o -c example.cpp
example.cpp: In function ‘bool some_function(MyClass)’:
example.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-
type]
   12 | }
      | ^

$ /usr/bin/g++-10 --version
g++-10 (Debian 10.2.0-16) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/bin/g++-10 -std=c++2a -o /tmp/example.cpp.o -c example.cpp
example.cpp: In function ‘bool some_function(MyClass)’:
example.cpp:6:6: error: type precision mismatch in switch statement
    6 | bool some_function(MyClass x)
      |      ^~~~~~~~~~~~~
switch (_1) <default: <D.2095>, case 0: <D.2092>>
example.cpp:6:6: internal compiler error: ‘verify_gimple’ failed
0x128422d verify_gimple_in_seq(gimple*)
        ../../src/gcc/tree-cfg.c:5144
0xf85436 gimplify_body(tree_node*, bool)
        ../../src/gcc/gimplify.c:14888
0xf856a3 gimplify_function_tree(tree_node*)
        ../../src/gcc/gimplify.c:14978
0xdbbe27 cgraph_node::analyze()
        ../../src/gcc/cgraphunit.c:670
0xdbee27 analyze_functions
        ../../src/gcc/cgraphunit.c:1227
0xdbf9f2 symbol_table::finalize_compilation_unit()
        ../../src/gcc/cgraphunit.c:2986
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

$ /usr/lib/gcc-snapshot/bin/g++ --version
g++ (Debian 20201127-1) 11.0.0 20201127 (experimental) [master revision
3493b0c3281:5c47353bc97:5e9f814d754be790aec5b69a95699a8af2654058]
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/lib/gcc-snapshot/bin/g++ -std=c++2a -o /tmp/example.cpp.o -c example.cpp
example.cpp: In function 'bool some_function(MyClass)':
example.cpp:6:6: error: type precision mismatch in switch statement
    6 | bool some_function(MyClass x)
      |      ^~~~~~~~~~~~~
switch (_1) <default: <D.2107>, case 0: <D.2104>>
example.cpp:6:6: internal compiler error: 'verify_gimple' failed
0x12f35bd verify_gimple_in_seq(gimple*)
        ../../src/gcc/tree-cfg.c:5119
0x1006b66 gimplify_body(tree_node*, bool)
        ../../src/gcc/gimplify.c:15329
0x1006ced gimplify_function_tree(tree_node*)
        ../../src/gcc/gimplify.c:15400
0xe37367 cgraph_node::analyze()
        ../../src/gcc/cgraphunit.c:670
0xe39e27 analyze_functions
        ../../src/gcc/cgraphunit.c:1235
0xe3aa1d symbol_table::finalize_compilation_unit()
        ../../src/gcc/cgraphunit.c:2513
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.

Downstream ticket:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976024

Your bugs page says you also want a preprocessed source – I don't see how it's
useful, but sure: Please find attached the preprocessed file "example.ii".

Cheers,
Ben

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

end of thread, other threads:[~2021-01-05 21:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 13:54 [Bug c++/98043] New: (Regression) ICE in verify_gimpl due to bitpacked enum class (amd64) BenWiederhake.GitHub at gmx dot de
2020-11-30  8:07 ` [Bug c++/98043] " rguenth at gcc dot gnu.org
2020-11-30  8:16 ` [Bug c++/98043] [10/11 Regression] ICE ‘verify_gimple’ failed since r10-5122-g6fcb7ebb377f27c7 since r10-5122-g6fcb7ebb377f27c7 marxin at gcc dot gnu.org
2020-11-30 13:16 ` [Bug c++/98043] [8/9/10/11 Regression] ICE ‘verify_gimple’ failed since r5-3726-g083e891e69429f93b958f6c18e2d52f515bae572 jakub at gcc dot gnu.org
2020-11-30 14:22 ` mpolacek at gcc dot gnu.org
2020-12-01 23:44 ` mpolacek at gcc dot gnu.org
2020-12-01 23:44 ` mpolacek at gcc dot gnu.org
2020-12-07 17:38 ` cvs-commit at gcc dot gnu.org
2020-12-07 17:51 ` [Bug c++/98043] [8/9/10 " mpolacek at gcc dot gnu.org
2020-12-07 21:03 ` BenWiederhake.GitHub at gmx dot de
2020-12-07 21:08 ` mpolacek at gcc dot gnu.org
2020-12-08 22:07 ` BenWiederhake.GitHub at gmx dot de
2020-12-08 22:25 ` mpolacek at gcc dot gnu.org
2021-01-05 21:30 ` cvs-commit at gcc dot gnu.org
2021-01-05 21:35 ` [Bug c++/98043] [8/9 " mpolacek 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).