public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/34301]  New: GNAT Bug detected: visibility
@ 2007-11-30 11:38 tomas at cernaj dot de
  2007-11-30 12:53 ` [Bug ada/34301] " sam at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tomas at cernaj dot de @ 2007-11-30 11:38 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug ada/34301] GNAT Bug detected: visibility
  2007-11-30 11:38 [Bug ada/34301] New: GNAT Bug detected: visibility tomas at cernaj dot de
@ 2007-11-30 12:53 ` sam at gcc dot gnu dot org
  2007-11-30 16:53 ` tomas at cernaj dot de
  2007-11-30 16:57 ` sam at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-11-30 12:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sam at gcc dot gnu dot org  2007-11-30 12:52 -------
GCC 4.3.0 will give a proper error message:

    29.     X : constant access T_Type := TA.To_Pointer (50);
                                                         |
        >>> expected private type "System.Address"
        >>> found type universal integer

You have to use "System.Storage_Elements.To_Address (50)" here.


-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gcc dot gnu dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34301


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

* [Bug ada/34301] GNAT Bug detected: visibility
  2007-11-30 11:38 [Bug ada/34301] New: GNAT Bug detected: visibility tomas at cernaj dot de
  2007-11-30 12:53 ` [Bug ada/34301] " sam at gcc dot gnu dot org
@ 2007-11-30 16:53 ` tomas at cernaj dot de
  2007-11-30 16:57 ` sam at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tomas at cernaj dot de @ 2007-11-30 16:53 UTC (permalink / raw)
  To: gcc-bugs



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


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

* [Bug ada/34301] GNAT Bug detected: visibility
  2007-11-30 11:38 [Bug ada/34301] New: GNAT Bug detected: visibility tomas at cernaj dot de
  2007-11-30 12:53 ` [Bug ada/34301] " sam at gcc dot gnu dot org
  2007-11-30 16:53 ` tomas at cernaj dot de
@ 2007-11-30 16:57 ` sam at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-11-30 16:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sam at gcc dot gnu dot org  2007-11-30 16:57 -------
As I said, there were a real problem, but it has already been fixed in GCC
4.3.0 which has not yet been released.

For what you are trying to achieve, you should rather declare X as

  X : T_Type;
  for X'Address use System.Storage_Elements.To_Address (50);

but this question should have been brought onto the comp.lang.ada newsgroup
instead of here :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34301


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

end of thread, other threads:[~2007-11-30 16:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-30 11:38 [Bug ada/34301] New: GNAT Bug detected: visibility tomas at cernaj dot de
2007-11-30 12:53 ` [Bug ada/34301] " sam at gcc dot gnu dot org
2007-11-30 16:53 ` tomas at cernaj dot de
2007-11-30 16:57 ` sam at gcc dot gnu dot 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).