public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/51690] New: Ada.Finalization with pointer field without explicit initialization confuses compiler
@ 2011-12-28  8:36 garynot at comcast dot net
  0 siblings, 0 replies; only message in thread
From: garynot at comcast dot net @ 2011-12-28  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51690
           Summary: Ada.Finalization with pointer field without explicit
                    initialization confuses compiler
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: garynot@comcast.net


Created attachment 26192
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26192
26 line source file, self contained except for Ada.Text_Io which can be
eliminated.

Ada.Finalization plus access type fields that are not explicitly initialized in
the type declaration cause the compiler to complain that it has not seen the
body of its own internally generated support routines.

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato
-gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa
-pass-exit-codes -O -g -I- -gnatA /home/geb/foo.gnat.bug3/pb_code_main.adb
/home/geb/foo.gnat.bug3/pb_code_main.adb:10:05: warning: cannot call "F207b"
before body seen
/home/geb/foo.gnat.bug3/pb_code_main.adb:10:05: warning: Program_Error will be
raised at run time
gnatmake: "/home/geb/foo.gnat.bug3/pb_code_main.adb" compilation error

The number in "F207b" varies greatly as one works towards a cut down example. 
The "b" in F207b is sometimes an "s".  But this is always the form of the
complaint.

The attached file is about as minimal as I've been able to make it, 26 lines. 
Compile it with the options above.  Eliminate any type, an field, or change the
access type to something that is not an access type, and the problem goes away.

There is a workaround.  Explicitly initialize the access type field to ":=
null;".
In a real program this means explicitly initializing all access type fields to
null but it seems to get the job done.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-28  4:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-28  8:36 [Bug ada/51690] New: Ada.Finalization with pointer field without explicit initialization confuses compiler garynot at comcast dot net

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