public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "demoonlit at panathenaia dot halfmoon.jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range
Date: Wed, 18 Aug 2021 22:32:54 +0000	[thread overview]
Message-ID: <bug-101970-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101970
           Summary: [11 regression] ICE on 'Enum_Rep for the enum that
                    filled its representation range
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: demoonlit at panathenaia dot halfmoon.jp
  Target Milestone: ---

Created attachment 51322
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51322&action=edit
full test code

Perhaps this is a regression by fixing the bug 101094.

'Enum_Rep causes GNAT bug Box, with the enum type containing the number of
elements to fill just its (signed?) representation range.

Thanks.

#### test code ####

Here is the abbreviated test code.
The full code is attached.

with Ada.Integer_Text_IO;
with Ada.Text_IO;
procedure test_enumrep2 is
   type T is (E80, ..., E00, ..., E7F); -- 256 elements
   for T use (E80 => -16#80#, ..., E00 => 16#00#, ..., E7F => 16#7F#); -- -128
to +127
   for T'Size use 8;
   procedure P (X : T);
   pragma No_Inline (P);
   procedure P (X : T) is
   begin
      Ada.Integer_Text_IO.Put (T'Pos (X));
      Ada.Integer_Text_IO.Put (T'Enum_Rep (X)); -- GNAT BUG DETECTED
      Ada.Text_IO.New_Line;
   end P;
begin
   P (T'First);
   P (T'Last);
end test_enumrep2;

#### gcc-10.2.0 ####

% /opt/ytomino/gcc-10.2.0/bin/gnatmake --version
GNATMAKE 10.2.0
Copyright (C) 1995-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.

% /opt/ytomino/gcc-10.2.0/bin/gnatmake test_enumrep2.adb
gcc -c test_enumrep2.adb
gnatbind -x test_enumrep2.ali
gnatlink test_enumrep2.ali

% ./test_enumrep2 
          0       -128
        255        127

It's fine.

#### gcc-11.1.0 ####

% /opt/ytomino/gcc-11.1.0/bin/gnatmake --version
GNATMAKE 11.1.0
Copyright (C) 1995-2021, 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.

% /opt/ytomino/gcc-11.1.0/bin/gnatmake test_enumrep2.adb
gcc -c test_enumrep2.adb
gnatbind -x test_enumrep2.ali
gnatlink test_enumrep2.ali
% ./test_enumrep2
          0        128
        255        127

Note, T'Enum_Rep(T'First) returns the unsigned value in gcc-11.1 because bug
101094.

#### gcc-11.2.0 ####

% /opt/ytomino/gcc-11.2.0/bin/gnatmake --version
GNATMAKE 11.2.0
Copyright (C) 1995-2021, 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.

% /opt/ytomino/gcc-11.2.0/bin/gnatmake test_enumrep2
gcc -c test_enumrep2.adb
+===========================GNAT BUG DETECTED==============================+
| 11.2.0 (x86_64-linux-gnu) GCC error:                                     |
| in build_binary_op, at ada/gcc-interface/utils2.c:1164                   |
| Error detected at test_enumrep2.adb:107:44                               |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

test_enumrep2.adb

compilation abandoned
gnatmake: "test_enumrep2.adb" compilation error

             reply	other threads:[~2021-08-18 22:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 22:32 demoonlit at panathenaia dot halfmoon.jp [this message]
2021-08-19  7:58 ` [Bug ada/101970] [11/12 " rguenth at gcc dot gnu.org
2021-09-12 10:41 ` ebotcazou at gcc dot gnu.org
2021-09-12 11:33 ` ebotcazou at gcc dot gnu.org
2021-09-14  9:35 ` cvs-commit at gcc dot gnu.org
2021-09-14  9:36 ` cvs-commit at gcc dot gnu.org
2021-09-14  9:36 ` ebotcazou at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101970-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).