[Ada] Adjust alignment warning machinery

Eric Botcazou ebotcazou@adacore.com
Tue Jun 24 18:22:00 GMT 2008


On strict-alignment platforms the Ada compiler warns for an unchecked 
conversion between pointers (or addresses) when the pointed-to types
don't have the same alignment.  The machinery was slightly impaired by
the transition to POINTER_PLUS_EXPR.

Fixed thusly, tested on x86 and SPARC, applied on the mainline and 4.3 branch.


2008-06-24  Eric Botcazou  <ebotcazou@adacore.com>

	* utils2.c (known_alignment): Derive the alignment from pointed-to
	types only if it is otherwise unknown.
	<INTEGER_CST>: Tidy.
	<MULT_EXPR>: Likewise.
	<POINTER_PLUS_EXPR>: If the alignment of the offset is unknown, use
	that of the base.


2008-06-24  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/warn5.adb: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 3845 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080624/b504b2ea/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warn5.adb
Type: text/x-adasrc
Size: 815 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080624/b504b2ea/attachment-0001.bin>


More information about the Gcc-patches mailing list