From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23805 invoked by alias); 16 Dec 2007 13:57:26 -0000 Received: (qmail 23768 invoked by uid 48); 16 Dec 2007 13:57:14 -0000 Date: Sun, 16 Dec 2007 13:57:00 -0000 Subject: [Bug ada/34496] New: [4.2 regression] prefixed notation allows changing the value of a constant X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ludovic at ludovic-brenta dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-12/txt/msg01493.txt.bz2 with text_io; procedure test1 is package pak3 is type T1 is tagged record x0: integer; end record; procedure p1 (x1: access T1; val: integer); x2: aliased constant T1 := (x0 => 3); x3: access constant T1 := x2'access; end pak3; package body pak3 is procedure p1 (x1: access T1; val: integer) is begin x1.x0 := val; end p1; end pak3; begin text_io.put_line(integer'image(pak3.x2.x0)); pak3.x2.p1(5); -- line 25 text_io.put_line(integer'image(pak3.x2.x0)); pak3.x3.all.p1(7); -- line 27 -- pak3.x3.p1(7); -- this one is detected text_io.put_line(integer'image(pak3.x2.x0)); end test1; GCC 4.1.2: $ gnatmake -gnat05 test1 gcc-4.1 -c -gnat05 test1.adb test1.adb:25:08: expected an access type with designated type "T1" defined at line 5 test1.adb:25:08: found type "T1" defined at line 5 test1.adb:27:12: expected an access type with designated type "T1" defined at line 5 test1.adb:27:12: found type "T1" defined at line 5 The error messages are not very good (they should say something like "found type "constant T1"") but the program is indeed illegal. GCC 4.2.2: $ gnatmake -gnat05 test1 gcc-4.2 -c -gnat05 test1.adb gnatbind -x test1.ali gnatlink test1.ali $ ./test1 3 5 7 -- Summary: [4.2 regression] prefixed notation allows changing the value of a constant Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ludovic at ludovic-brenta dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34496