[Ada] Fix undefined reference at link time for array size symbol

Eric Botcazou ebotcazou@adacore.com
Thu Apr 11 19:13:00 GMT 2013


This fixes a link failure for an array object declared with an array of array 
type under very specific circumstances, as the compiler doesn't consistently 
consider that the size of the array type is constant, depending on the unit 
which is being compiled.

I need to export the skip_simple_constant_arithmetic function I wrote a few 
years ago, so I've moving it next to its model skip_simple_arithmetic and 
tidying up the implementation of the latter (but no functional changes).

Tested on x86_64-suse-linux, applied on mainline.


2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>

	* stor-layout.c (skip_simple_constant_arithmetic): Move to...
	* tree.c (skip_simple_constant_arithmetic): ...here and make public.
	(skip_simple_arithmetic): Tidy up.
	* tree.h (skip_simple_constant_arithmetic): Declare.


2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (elaborate_expression_1): Skip only constant
	arithmetics when looking for a read-only variable in the expression.


2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/array23.adb: New test.
	* gnat.dg/array23_pkg[123].ads: New helpers.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 5246 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130411/28090ee0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array23.adb
Type: text/x-adasrc
Size: 144 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130411/28090ee0/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array23_pkg1.ads
Type: text/x-adasrc
Size: 253 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130411/28090ee0/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array23_pkg2.ads
Type: text/x-adasrc
Size: 198 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130411/28090ee0/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array23_pkg3.ads
Type: text/x-adasrc
Size: 64 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130411/28090ee0/attachment-0004.bin>


More information about the Gcc-patches mailing list