diff mbox

[Ada] Issue missing warning for 'Size attribute

Message ID 4157012.KKVEd90qbA@polaris
State New
Headers show

Commit Message

Eric Botcazou May 25, 2015, 9:29 p.m. UTC
The documentation says that the compiler issues a warning for the 'Size 
attribute on discrete types if the specified value is larger than 64, but we 
failed to so for values between 65 and 128.

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


2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils.c (maybe_pad_type): Do not apply adjustment to
	original size for elementary types before issuing the size warning.


2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/warn11.adb: New test.
	* gnat.dg/specs/alignment2.ads: Add dg-warning directive.
diff mbox

Patch

Index: ada/gcc-interface/utils.c
===================================================================
--- ada/gcc-interface/utils.c	(revision 223656)
+++ ada/gcc-interface/utils.c	(working copy)
@@ -1426,7 +1426,7 @@  built:
   if (CONTAINS_PLACEHOLDER_P (orig_size))
     orig_size = max_size (orig_size, true);
 
-  if (align)
+  if (align && AGGREGATE_TYPE_P (type))
     orig_size = round_up (orig_size, align);
 
   if (!operand_equal_p (size, orig_size, 0)