public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range
@ 2021-08-18 22:32 demoonlit at panathenaia dot halfmoon.jp
  2021-08-19  7:58 ` [Bug ada/101970] [11/12 " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: demoonlit at panathenaia dot halfmoon.jp @ 2021-08-18 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/101970] [11/12 regression] ICE on 'Enum_Rep for the enum that filled its representation range
  2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
@ 2021-08-19  7:58 ` rguenth at gcc dot gnu.org
  2021-09-12 10:41 ` ebotcazou at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-19  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
            Summary|[11 regression] ICE on      |[11/12 regression] ICE on
                   |'Enum_Rep for the enum that |'Enum_Rep for the enum that
                   |filled its representation   |filled its representation
                   |range                       |range

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/101970] [11/12 regression] ICE on 'Enum_Rep for the enum that filled its representation range
  2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-09-12 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-09-12
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This raises an assertion failure on the mainline:

eric@fomalhaut:~/gnat> ~/install/gcc/bin/gcc -c p.adb
+===========================GNAT BUG DETECTED==============================+
| 12.0.0 20210909 (experimental) (x86_64-suse-linux) Assert_Failure
checks.adb:7793|
| Error detected at p.adb:107:44                                           |
| Compiling p.adb 

but this seems to be quite an artificial testcase.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/101970] [11/12 regression] ICE on 'Enum_Rep for the enum that filled its representation range
  2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-09-12 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixing.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/101970] [11/12 regression] ICE on 'Enum_Rep for the enum that filled its representation range
  2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-14  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:bd55fa102715c7442c050b193dadfdb5337e2377

commit r12-3522-gbd55fa102715c7442c050b193dadfdb5337e2377
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Sep 14 11:33:05 2021 +0200

    Fix PR ada/101970

    This is a regression present on the mainline and 11 branch in the form of
an
    ICE for an enumeration type with a full signed representation for its size.

    gcc/ada/
            PR ada/101970
            * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Enum_Rep>:
            Use an unchecked conversion instead of a regular conversion in the
            enumeration case and remove Conversion_OK flag in the integer case.
            <Attribute_Pos>: Remove superfluous test.

    gcc/testsuite/
            * gnat.dg/enum_rep2.adb: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/101970] [11/12 regression] ICE on 'Enum_Rep for the enum that filled its representation range
  2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-14  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:40c0122a1c5c364346d2d1c96dce66aea2e5032c

commit r11-8991-g40c0122a1c5c364346d2d1c96dce66aea2e5032c
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Sep 14 11:33:05 2021 +0200

    Fix PR ada/101970

    This is a regression present on the mainline and 11 branch in the form of
an
    ICE for an enumeration type with a full signed representation for its size.

    gcc/ada/
            PR ada/101970
            * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Enum_Rep>:
            Use an unchecked conversion instead of a regular conversion in the
            enumeration case and remove Conversion_OK flag in the integer case.
            <Attribute_Pos>: Remove superfluous test.

    gcc/testsuite/
            * gnat.dg/enum_rep2.adb: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/101970] [11/12 regression] ICE on 'Enum_Rep for the enum that filled its representation range
  2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
                   ` (4 preceding siblings ...)
  2021-09-14  9:36 ` cvs-commit at gcc dot gnu.org
@ 2021-09-14  9:36 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-09-14  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-14  9:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 22:32 [Bug ada/101970] New: [11 regression] ICE on 'Enum_Rep for the enum that filled its representation range demoonlit at panathenaia dot halfmoon.jp
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

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).