[Ada] Fix problems with deferred constants and address clauses
Eric Botcazou
ebotcazou@adacore.com
Fri Aug 1 12:40:00 GMT 2008
The Ada compiler accepts address clauses on deferred constants, e.g.
package P is
C : constant Natural := 1;
C2 : constant Natural;
for C2'Address use C'Address;
private
C2 : constant Natural := 1;
end P;
but it was not honoring them in all cases and was even ICEing on some
particular form. The attached patch should fix that by specializing
their handling in Gigi.
Tested on i586-suse-linux, applied on the mainline.
2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Remove dead
code. Do not get full definition of deferred constants with address
clause for a use. Do not ignore deferred constant definitions with
address clause. Ignore constant definitions already marked with the
error node.
<object>: Remove obsolete comment. For a deferred constant with
address clause, get the initializer from the full view.
* gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>:
Rework and remove obsolete comment.
<N_Object_Declaration>: For a deferred constant with address clause,
mark the full view with the error node.
* gcc-interface/utils.c (convert_to_fat_pointer): Rework and fix
formatting nits.
2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/deferred_const1.adb: New test.
* gnat.dg/deferred_const2.adb: Likewise.
* gnat.dg/deferred_const2_pkg.ad[sb]: New helper.
* gnat.dg/deferred_const3.adb: New test.
* gnat.dg/deferred_const3_pkg.ad[sb]: New helper.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 10828 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const1.adb
Type: text/x-adasrc
Size: 276 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const2.adb
Type: text/x-adasrc
Size: 203 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const2_pkg.adb
Type: text/x-adasrc
Size: 201 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const3_pkg.ads
Type: text/x-adasrc
Size: 356 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const2_pkg.ads
Type: text/x-adasrc
Size: 224 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const3.adb
Type: text/x-adasrc
Size: 344 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred_const3_pkg.adb
Type: text/x-adasrc
Size: 342 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080801/c459c0f6/attachment-0007.bin>
More information about the Gcc-patches
mailing list