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

            Bug ID: 116048
           Summary: cc1gm2 ICE when encountering qualident of the wrong
                    kind
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

Following on from PR-115957 further ICEs can be generated by using the wrong
qualident (kind) of symbol.  For example using a variable instead of a type or
using a type instead of a const.  For example:

$ cat badtype.mod
MODULE badtype ;

PROCEDURE bar (VAR a: CARDINAL) ;
TYPE
   Foo = a ;
BEGIN
END bar ;

BEGIN
END badtype.

$ gm2 badtype.mod
 <parm_decl 0xffffba855480 a
    type <reference_type 0xffffba812b28
        type <integer_type 0xffffba7c5690 CARDINAL public unsigned SI
            size <integer_cst 0xffffba7b1fc0 constant 32>
            unit-size <integer_cst 0xffffba7b1fd8 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xffffba7c5690 precision:32 min <integer_cst 0xffffba7ca000 0> max <integer_cst
0xffffba7b1fa8 4294967295>
            pointer_to_this <pointer_type 0xffffba7ffe70> reference_to_this
<reference_type 0xffffba812b28>>
        unsigned DI
        size <integer_cst 0xffffba7b1d80 constant 64>
        unit-size <integer_cst 0xffffba7b1d98 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xffffba812b28>
    readonly unsigned DI badtype.mod:3:20 size <integer_cst 0xffffba7b1d80 64>
unit-size <integer_cst 0xffffba7b1d98 8>
    align:64 warn_if_not_align:0 context <function_decl 0xffffba854f00 bar>
arg-type <reference_type 0xffffba812b28>>
In function 'bar':
cc1gm2: internal compiler error: ../../gcc/m2/gm2-gcc/m2type.cc:1805:condition
m2tree_is_type (type) failed
0x30005db internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:491
0xe25087 m2type_BuildStartType
        ../../gcc/m2/gm2-gcc/m2type.cc:1805
0xe66d07 DeclareType
        m2/gm2-compiler-boot/M2GCCDeclare.c:3227
0xe6f193 TypeConstFullyDeclared
        m2/gm2-compiler-boot/M2GCCDeclare.c:7089
0xe66587 DeclareTypeConstFully
        m2/gm2-compiler-boot/M2GCCDeclare.c:2866
0xe66723 Body
        m2/gm2-compiler-boot/M2GCCDeclare.c:3021
0xed452b Sets_ForeachElementInSetDo
        m2/gm2-compiler-boot/Sets.c:336
0xe6683f ForeachTryDeclare
        m2/gm2-compiler-boot/M2GCCDeclare.c:3057
0xe66a1b DeclaredOutstandingTypes
        m2/gm2-compiler-boot/M2GCCDeclare.c:3115
0xe688eb DeclareTypesConstantsProceduresInRange
        m2/gm2-compiler-boot/M2GCCDeclare.c:4171
0xebf51b M2Scope_ForeachScopeBlockDo3
        m2/gm2-compiler-boot/M2Scope.c:701
0xe68b27 DeclareTypesConstantsProcedures
        m2/gm2-compiler-boot/M2GCCDeclare.c:4268
0xe68cdb StartDeclareProcedureScope
        m2/gm2-compiler-boot/M2GCCDeclare.c:4339
0xe70963 M2GCCDeclare_StartDeclareScope
        m2/gm2-compiler-boot/M2GCCDeclare.c:8119
0xe7402b CodeProcedureScope
        m2/gm2-compiler-boot/M2GenGCC.c:3425
0xe71bcf CodeStatement
        m2/gm2-compiler-boot/M2GenGCC.c:1936
0xe829b7 M2GenGCC_ConvertQuadsToTree
        m2/gm2-compiler-boot/M2GenGCC.c:9601
0xebf487 M2Scope_ForeachScopeBlockDo2
        m2/gm2-compiler-boot/M2Scope.c:669
0xe5d83f M2Code_CodeBlock
        m2/gm2-compiler-boot/M2Code.c:508
0xe43c93 Lists_ForeachItemInListDo
        m2/gm2-compiler-boot/Lists.c:391

Reply via email to