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

            Bug ID: 112946
           Summary: Assignment of string to enumeration or set crashes
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: juriad at gmail dot com
  Target Milestone: ---

Created attachment 56846
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56846&action=edit
reproducer + gcc crash output + crash report

I am playing with Modula-2 (due to Advent of Code). I compiled GCC from master
branch (fbfe43daec6443978df65530dc5f7f3f8a4e6f9e).

The attached program crashes when compiling (the error differs between strings
of length 1 and 2):

gm2 -freport-bug -fiso -static-libgm2 -o prg bug.mod

The full output is attached as well as the referenced report from /tmp/:

cc1gm2: internal compiler error: tree check: expected integer_cst, have
string_cst in get_len, at tree.h:6473

The expected behavior would be to show the error as usual with highlighted line
and explanation.

Apart from this crash, I encountered one more issue which may not be an error
(no idea; I have less than 1 day of experience with Modula) but would deserve
at least a warning. Arithmetic between set and enumeration does not produce
what I would expect.

DIRS := Dirs{Left, Right};
DIRS := DIRS + Up;
IF NOT (Up IN DIRS) THEN
        HALT
END;

On the other hand:

DIRS := Dirs{Left, Right} + Up;

leads to another crash:

cc1gm2: internal compiler error: expecting type of constant to be a set

Reply via email to