[Ada] Refine diagnostics on size or position mistakes in component rep clause

Eric Botcazou ebotcazou@adacore.com
Sun Jan 6 12:29:00 GMT 2013


Atomic or Volatile components must occupy their "natural" size and position
in records, with allocated room and alignment matching what the component type
calls for in absence of a rep clause for the component.

There was a dissimetry in the gigi code checking for this, with
- the checks on position featuring a single case for volatile covering
 atomic as well, and a gcc_unreachable() at the end.
- the checks on size featuring a case for atomic only, missing the
 lone-volatile case and not having a gcc_unreachable() at the end.

The change introduced here improves this code to have the size
and position checks match each other, adding the missing case and
the gcc_unreachable() to the size checks, and splitting the volatile
case into two more precise checks for position.

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


2013-01-06  Olivier Hainque  <hainque@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_field): Emit a specialized
	diagnostic for component size mismatch wrt volatile requirements.
	Add a gcc_unreachable() at the end of the checks for size.  Split
	the check on volatile for positions into one check on atomic and
	a subsequent one on volatile.


2013-01-06  Olivier Hainque  <hainque@adacore.com>

	* gnat.dg/specs/clause_on_volatile.ads: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 2345 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130106/bfb6e26b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clause_on_volatile.ads
Type: text/x-adasrc
Size: 1731 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130106/bfb6e26b/attachment-0001.bin>


More information about the Gcc-patches mailing list