Bug 769750

Summary: generic formal type rename + Ada.Finalization = cannot compile
Product: [Fedora] Fedora Reporter: Gary Barnes <gaedba>
Component: gcc4Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: aravindvijayan224185, cwickert, julian
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-17 15:30:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
file containing the source. none

Description Gary Barnes 2011-12-22 04:37:30 UTC
Created attachment 549128 [details]
file containing the source.

Description of problem:

Compiler complains it hasn't seen the body of a routine that doesn't exist.
At a guess, it is referring to some internally generated skin or type operator and it cannot find it.  The program is very small.

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato -gnatU -gnatwa -gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa -pass-exit-codes -O -g -I- -gnatA pb_code_main.adb
pb_code_main.adb:39:05: warning: in instantiation at line 32
pb_code_main.adb:39:05: warning: cannot call "F141b" before body seen
pb_code_main.adb:39:05: warning: Program_Error will be raised at run time


Version-Release number of selected component (if applicable):

gcc (GCC) 4.5.3 20110419 for GNAT GPL 2011 (20110419)
Copyright (C) 2010 Free Software Foundation, Inc.


How reproducible:

Very reproducible.

Steps to Reproduce:
1. Create a text file named pb_code_main.adb with these contents:
with Ada.Finalization;
with Ada.Text_Io;

procedure Pb_Code_Main is

    type Iterator_Overhead_T is
       new Ada.Finalization.Controlled with null record;

    generic
        type Depr_T is private;
    package Container_Item_Type is
        subtype Item_T is Depr_T;
    end Container_Item_Type;

    package Chunk_T_Item is
       new Container_Item_Type (Depr_T => Integer);

    generic
        with package Item_Type is new Container_Item_Type (<>);
    package Container_Ek_Items is
        type Node_T is
            record
                Item   : Item_Type.Item_T;
            end record;
        type Node_P is access Node_T;

        type Iterator_T is
            record
                Overhead  : Iterator_Overhead_T;
                Node      : Node_P;
            end record;
    end Container_Ek_Items;

    package Chunk_Set is
       new Container_Ek_Items (Item_Type => Chunk_T_Item);

    X : Chunk_Set.Iterator_T;
    pragma Unreferenced (X);

begin
    Ada.Text_Io.Put_Line ("Successful elaboration.");
end Pb_Code_Main;


2. Compile with this command:

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn \
     -gnato -gnatU -gnatwa -gnatwe -gnatwi -gnatwj -gnatwK -gnatwl \
     -Wuninitialized -gnatVa -pass-exit-codes -O -g -I- -gnatA \
     pb_code_main.adb


3.
  
Actual results:

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato -gnatU -gnatwa -gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa -pass-exit-codes -O -g -I- -gnatA pb_code_main.adb
pb_code_main.adb:39:05: warning: in instantiation at line 32
pb_code_main.adb:39:05: warning: cannot call "F141b" before body seen
pb_code_main.adb:39:05: warning: Program_Error will be raised at run time


Expected results:

Expected it to compile.  Make almost any change and it compiles.

Additional info:

Comment 1 Christoph Wickert 2011-12-22 08:20:03 UTC
Are you sure you picked the right component for this bug?

Comment 2 Gary Barnes 2011-12-22 23:18:08 UTC
Hmmm, thought I picked gcc4.  I'll try changing it.

Comment 3 Aravind vijayan 2012-01-18 19:06:26 UTC
Hi Gary Barnes,
               Thank you for taking the time to report this bug.I believe this bug is fixed , i got both .ali and .o files with:

(gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC))

> gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn \
>     -gnato -gnatU -gnatwa -gnatwe -gnatwi -gnatwj -gnatwK -gnatwl \
>     -Wuninitialized -gnatVa -pass-exit-codes -O -g -I- -gnatA \
>     pb_code_main.adb


If you have time to update the package and re-test, please do so and report the results here.

Comment 4 Gary Barnes 2012-01-23 01:59:22 UTC
What does "update the package" mean?  If you mean run the Add/Remove Software process, it doesn't have any 4.6.2 possiblities for gcc/gnat.  Is there some way I can get my Fedora system to pull it in if that's what you meant by package?

I tried locating and downloading the sources for gcc 4.6.2 but it wants a more recent PPL which wants a more recent GPM which ...  Building gcc has gotten way too hard these last few years.

Hopefully there's a built gcc 4.6.2 I can get from Red Hat/Fedora?

Comment 5 Julian Leyh 2012-08-08 12:54:57 UTC
> gcc (GCC) 4.5.3 20110419 for GNAT GPL 2011 (20110419)

This is not part of Fedora. You should file this bug at AdaCore.

Please try out the Fedora version of GNAT, gcc-gnat.

I would vote for closing this bug as not applicable.