public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11
@ 2021-06-16 11:41 demoonlit at panathenaia dot halfmoon.jp
  2021-06-16 13:03 ` [Bug ada/101094] [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-06-16 11:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101094
           Summary: [11 regression] 'Enum_Rep returns a unsigned value for
                    the negative representation in gcc-11
           Product: gcc
           Version: 11.1.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: ---

'Enum_Rep returns a unsigned value for the run-time value having the negative
representation in gcc-11.
It also returns just a representation value for the compile-time value.

In gcc-10 or older, it always returns just a representation value.
Is this intentional changed or not?

Test code
---------

with Ada.Text_IO;
with Ada.Integer_Text_IO;
procedure main is
   type T is (Nega, Zero, Posi);
   for T use (Nega => -1, Zero => 0, Posi => 1);
begin
   -- literal
   Ada.Text_IO.Put ("Lite:");
   Ada.Integer_Text_IO.Put (T'Enum_Rep (Nega)); -- "-1"
   Ada.Text_IO.New_Line;
   -- compile-time constant
   declare
      Cons : constant T := Nega;
   begin
      Ada.Text_IO.Put ("Cons:");
      Ada.Integer_Text_IO.Put (T'Enum_Rep (Cons)); -- "-1"
      Ada.Text_IO.New_Line;
   end;
   -- variable
   declare
      Vari : T := T'Value ("Nega");
   begin
      Ada.Text_IO.Put ("Vari:");
      Ada.Integer_Text_IO.Put (T'Enum_Rep (Vari)); -- "255"
      Ada.Text_IO.New_Line;
   end;
   -- parameter
   declare
      procedure Sub1 (Para : T) is
      begin
         Ada.Text_IO.Put ("Para:");
         Ada.Integer_Text_IO.Put (T'Enum_Rep (Para)); -- "255"
         Ada.Text_IO.New_Line;
      end Sub1;
   begin
      Sub1 (Nega);
   end;
end main;

With gcc-10
-----------

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

$ gnatmake main
gcc -c main.adb
gnatbind -x main.ali
gnatlink main.ali

$ ./main
Lite:         -1
Cons:         -1
Vari:         -1
Para:         -1

With gcc-11
-----------

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

$ gnatmake main
gcc -c main.adb
gnatbind -x main.ali
gnatlink main.ali

% ./main
Lite:         -1
Cons:         -1
Vari:        255
Para:        255

Thanks.

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

* [Bug ada/101094] [11/12 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11
  2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
@ 2021-06-16 13:03 ` rguenth at gcc dot gnu.org
  2021-06-30  9:37 ` 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-06-16 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.2
            Summary|[11 regression] 'Enum_Rep   |[11/12 regression]
                   |returns a unsigned value    |'Enum_Rep returns a
                   |for the negative            |unsigned value for the
                   |representation in gcc-11    |negative representation in
                   |                            |gcc-11

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

* [Bug ada/101094] [11/12 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11
  2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
  2021-06-16 13:03 ` [Bug ada/101094] [11/12 " rguenth at gcc dot gnu.org
@ 2021-06-30  9:37 ` ebotcazou at gcc dot gnu.org
  2021-06-30  9:38 ` 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-06-30  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> In gcc-10 or older, it always returns just a representation value.
> Is this intentional changed or not?

No, it's an oversight.

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

* [Bug ada/101094] [11/12 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11
  2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
  2021-06-16 13:03 ` [Bug ada/101094] [11/12 " rguenth at gcc dot gnu.org
  2021-06-30  9:37 ` ebotcazou at gcc dot gnu.org
@ 2021-06-30  9:38 ` ebotcazou at gcc dot gnu.org
  2021-07-01 16:13 ` [Bug ada/101094] [11/12 regression] Enum_Rep returns unsigned value for negative representation 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-06-30  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

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/101094] [11/12 regression] Enum_Rep returns unsigned value for negative representation
  2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
                   ` (2 preceding siblings ...)
  2021-06-30  9:38 ` ebotcazou at gcc dot gnu.org
@ 2021-07-01 16:13 ` cvs-commit at gcc dot gnu.org
  2021-07-01 16:14 ` cvs-commit at gcc dot gnu.org
  2021-07-01 18:02 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-01 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:cdf4576b201aa81fd853b06242b16e4215ead5a9

commit r12-1961-gcdf4576b201aa81fd853b06242b16e4215ead5a9
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Jul 1 17:57:16 2021 +0200

    Use intermediate integer type with proper signedness

    This is a minor regression present on mainline and 11 branch, whereby the
    value of the Enum_Rep attribute is always unsigned.

    gcc/ada/
            PR ada/101094
            * exp_attr.adb (Get_Integer_Type): Return an integer type with the
            same signedness as the input type.

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

* [Bug ada/101094] [11/12 regression] Enum_Rep returns unsigned value for negative representation
  2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
                   ` (3 preceding siblings ...)
  2021-07-01 16:13 ` [Bug ada/101094] [11/12 regression] Enum_Rep returns unsigned value for negative representation cvs-commit at gcc dot gnu.org
@ 2021-07-01 16:14 ` cvs-commit at gcc dot gnu.org
  2021-07-01 18:02 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-01 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:3a17c1663a96640874067988ffe36c1d06fb93a1

commit r11-8667-g3a17c1663a96640874067988ffe36c1d06fb93a1
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Jul 1 17:57:16 2021 +0200

    Use intermediate integer type with proper signedness

    This is a minor regression present on mainline and 11 branch, whereby the
    value of the Enum_Rep attribute is always unsigned.

    gcc/ada/
            PR ada/101094
            * exp_attr.adb (Get_Integer_Type): Return an integer type with the
            same signedness as the input type.

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

* [Bug ada/101094] [11/12 regression] Enum_Rep returns unsigned value for negative representation
  2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
                   ` (4 preceding siblings ...)
  2021-07-01 16:14 ` cvs-commit at gcc dot gnu.org
@ 2021-07-01 18:02 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-07-01 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
Thanks for reporting the problem.

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

end of thread, other threads:[~2021-07-01 18:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 11:41 [Bug ada/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 demoonlit at panathenaia dot halfmoon.jp
2021-06-16 13:03 ` [Bug ada/101094] [11/12 " rguenth at gcc dot gnu.org
2021-06-30  9:37 ` ebotcazou at gcc dot gnu.org
2021-06-30  9:38 ` ebotcazou at gcc dot gnu.org
2021-07-01 16:13 ` [Bug ada/101094] [11/12 regression] Enum_Rep returns unsigned value for negative representation cvs-commit at gcc dot gnu.org
2021-07-01 16:14 ` cvs-commit at gcc dot gnu.org
2021-07-01 18:02 ` 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).