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

            Bug ID: 120673
           Summary: Mutually dependent types crash the compiler
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: belka at caraus dot de
  Target Milestone: ---

Created attachment 61647
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61647&action=edit
-freport-bug output

The following code causes an ICE:

```
MODULE Test;

TYPE
  X = Y;
  Y = X;

PROCEDURE f();
VAR
  a: X;
END f;

BEGIN

END Test.
```

Details are in the attachment.

A few more notes. If I put the variable declaration outside of the procedure,
I'll get an error message.

```
MODULE Test;

TYPE
  X = Y;
  Y = X;

VAR
  a: X;

BEGIN

END Test.
```
> Test.mod:4:7: error: In definition module 'wrapc': circular dependancy error 
> found when trying to resolve 'X'

„wrapc“ doesn't look right in the error message. There is also a typo in
„dependency“.

If I remove the variable declaration, there is no error at all:

```
MODULE Test;

TYPE
  X = Y;
  Y = X;

END Test.
```

This is probably also wrong, still the invalid type declaration is still there.

Reply via email to