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/101094] New: [11 regression] 'Enum_Rep returns a unsigned value for the negative representation in gcc-11 Date: Wed, 16 Jun 2021 11:41:01 +0000 [thread overview] Message-ID: <bug-101094-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2021-06-16 11:41 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-16 11:41 demoonlit at panathenaia dot halfmoon.jp [this message] 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
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-101094-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: linkBe 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).