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

            Bug ID: 119826
           Summary: ICE: verify_type failed: type variant differs by
                    TYPE_MAX_VALUE with -g
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: a.horodniceanu at proton dot me
  Target Milestone: ---

The following was reduced from the onedrive client application:

```object.d
module object;
```

```onedrive.d
module onedrive;
import stdconv;
```

```stdconv.d
module stdconv;

int to(A)(A args)
{
    assert(false);
}
```

```webhook.d
module webhook;

import stdconv : to;

class Cgi {
        enum RequestMethod { Foo }

        const RequestMethod requestMethod = void;
}

void handle(Cgi cgi) {
        to(cgi.requestMethod);
}
```

Compile with:
```
$ gdc -c -g object.d  onedrive.d  stdconv.d  webhook.d -freport-bug
webhook.d:5:1: error: type variant differs by TYPE_MAX_VALUE
    5 | class Cgi {
      | ^
 <enumeral_type 0x7f0f9bd3c000 RequestMethod
    type <integer_type 0x7f0f9bc295e8 int asm_written public SI
        size <integer_cst 0x7f0f9bc20018 constant 32>
        unit-size <integer_cst 0x7f0f9bc20030 constant 4>
        align:32 warn_if_not_align:0 symtab:-1680624704 alias-set -1
canonical-type 0x7f0f9bc295e8 precision:32 min <integer_cst 0x7f0f9bc203a8
-2147483648> max <integer_cst 0x7f0f9bc203c0 2147483647>
        pointer_to_this <pointer_type 0x7f0f9bd36bd0>>
    static SI size <integer_cst 0x7f0f9bc20018 32> unit-size <integer_cst
0x7f0f9bc20030 4>
    align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f0f9bd3c000 precision:32 min <integer_cst 0x7f0f9bc203a8 -2147483648> max
<integer_cst 0x7f0f9bc203c0 2147483647>
    values <tree_list 0x7f0f9bd35c58
        purpose <identifier_node 0x7f0f9bd38480 Foo>
        value <const_decl 0x7f0f9bc0c168 Foo type <integer_type 0x7f0f9bc295e8
int>
            readonly constant VOID webhook.d:6:23
            align:1 warn_if_not_align:0 context <enumeral_type 0x7f0f9bd3c000
RequestMethod> initial <integer_cst 0x7f0f9bd2d900 0>>> context <record_type
0x7f0f9bd3c0a8 Cgi>
    chain <type_decl 0x7f0f9bd3a8c0 RequestMethod>>
 <enumeral_type 0x7f0f9bd3c1f8
    type <integer_type 0x7f0f9bc295e8 int asm_written public SI
        size <integer_cst 0x7f0f9bc20018 constant 32>
        unit-size <integer_cst 0x7f0f9bc20030 constant 4>
        align:32 warn_if_not_align:0 symtab:-1680624704 alias-set -1
canonical-type 0x7f0f9bc295e8 precision:32 min <integer_cst 0x7f0f9bc203a8
-2147483648> max <integer_cst 0x7f0f9bc203c0 2147483647>
        pointer_to_this <pointer_type 0x7f0f9bd36bd0>>
    readonly static SI size <integer_cst 0x7f0f9bc20018 32> unit-size
<integer_cst 0x7f0f9bc20030 4>
    align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f0f9bd3c1f8 precision:32
    values <tree_list 0x7f0f9bd35c58
        purpose <identifier_node 0x7f0f9bd38480 Foo>
        value <const_decl 0x7f0f9bc0c168 Foo type <integer_type 0x7f0f9bc295e8
int>
            readonly constant VOID webhook.d:6:23
            align:1 warn_if_not_align:0 context <enumeral_type 0x7f0f9bd3c000
RequestMethod> initial <integer_cst 0x7f0f9bd2d900 0>>>>
webhook.d:5:1: internal compiler error: ‘verify_type’ failed
0x5633f0b396ec diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x5633f0b512ed internal_error(char const*, ...)
        ???:0
0x5633ef8eed18 verify_type(tree_node const*)
        ???:0
0x5633eee8d238 DeclVisitor::visit(ClassDeclaration*)
        ???:0
0x5633eee866f9 build_decl_tree(Dsymbol*)
        ???:0
0x5633eee9da1f build_module_tree(Module*)
        ???:0
0x5633eee8a587 DeclVisitor::visit(Module*)
        ???:0
0x5633eee866f9 build_decl_tree(Dsymbol*)
        ???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

gcc was built with `--enable-checking=yes,extra` at version:
```
$ gdc --version
gdc (Gentoo Hardened 15.0.9999 p, commit
14fba9f4c43c849a94ffb97bf2a7ba924ed3af9c) 15.0.1 20250415 (experimental)
5621b3b5c9ebd98f1f18787a6fceb015d19d33a5
Copyright (C) 2025 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.
```
```

Reply via email to