[Bug ada/34301] GNAT Bug detected: visibility
--- Comment #2 from tomas at cernaj dot de 2007-11-30 16:53 --- Subject: Re: GNAT Bug detected: visibility > 29. X : constant access T_Type := TA.To_Pointer (50); [...] > You have to use "System.Storage_Elements.To_Address (50)" here. Hmm, thank you for the quick response, but the problem persists anyway... As I mentioned it compiles alright when moving the declaration into the public part of the spec (i.e. not deferred). Am I missing a point or is this indeed a valid construct? (I want the compiler to optimize an access to a fixed memory location.) Tomas -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34301
[Bug ada/34301] New: GNAT Bug detected: visibility
I got the following message with GNAT on Ubuntu 7.10 using following command: $ gcc-4.2 -O -S testpkg.adb +===GNAT BUG DETECTED==+ | 4.2.1 (Ubuntu 4.2.1-5ubuntu6) (x86_64-pc-linux-gnu) GCC error: | | in gnat_to_gnu_entity, bei ada/decl.c:230| | Error detected at testpkg.adb:24:9 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html.| | 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 gcc-4.2 or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==+ 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. testpkg.adb testpkg.ads compilation abandoned It doesn't matter if the -O switch is given or not. The files compiled are: testpkg.ads: with System; with System.Address_To_Access_Conversions; package TestPkg is type T_Type is record Bit0: Boolean; Bit1: Boolean; Bit2: Boolean; Bit3: Boolean; Bit4: Boolean; Bit5: Boolean; Bit6: Boolean; Bit7: Boolean; end record; pragma Pack (T_Type); for T_Type'Size use 8; X : constant access T_Type; Y : T_Type; procedure TestIt; private package TA is new System.Address_To_Access_Conversions (T_Type); X : constant access T_Type := TA.To_Pointer (50); end TestPkg; testpkg.adb: with System.Address_To_Access_Conversions; package body TestPkg is type U_Type is record Bit0: Boolean; Bit1: Boolean; Bit2: Boolean; Bit3: Boolean; Bit4: Boolean; Bit5: Boolean; Bit6: Boolean; Bit7: Boolean; end record; pragma Pack (U_Type); for U_Type'Size use 8; package UA is new System.Address_To_Access_Conversions (U_Type); Z : UA.Object_Pointer := UA.To_Pointer (49); procedure TestIt is begin X.Bit4 := True; Y.Bit5 := True; Z.Bit6 := True; end TestIt; end TestPkg; The error does only occur when using a deferred constant declaration for X. If it's not deferred it compiles OK. -- Summary: GNAT Bug detected: visibility Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tomas at cernaj dot de GCC host triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34301