This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix inconsistent diagnostics for support of Atomic aspect


This changes makes it so that the compiler issues the same diagnostics on
invalid bit-packed array types with atomic component whatever the origin
of the Atomic aspect.  For the following package:

package P is

  type Arr1 is array (1 .. 16) of Boolean;
  pragma Atomic_Components (Arr1);
  for Arr1'Component_Size use 1;

  type Arr2 is array (1 .. 16) of Boolean;
  pragma Atomic_Components (Arr2);
  pragma Pack (Arr2);

  type My_Boolean is new Boolean;
  pragma Atomic (My_Boolean);

  type Arr3 is array (1 .. 16) of My_Boolean;
  for Arr3'Component_Size use 1;

  type Arr4 is array (1 .. 16) of My_Boolean;
  pragma Pack (Arr4);

end P;

the compiler must issue the expected errors on Arr3 and Arr4:

     1. package P is
     2.
     3.   type Arr1 is array (1 .. 16) of Boolean;
     4.   pragma Atomic_Components (Arr1);
     5.   for Arr1'Component_Size use 1;
          |
        >>> incorrect component size for atomic components
        >>> only allowed value is 8

     6.
     7.   type Arr2 is array (1 .. 16) of Boolean;
     8.   pragma Atomic_Components (Arr2);
     9.   pragma Pack (Arr2);
          |
        >>> cannot pack atomic components

    10.
    11.   type My_Boolean is new Boolean;
    12.   pragma Atomic (My_Boolean);
    13.
    14.   type Arr3 is array (1 .. 16) of My_Boolean;
    15.   for Arr3'Component_Size use 1;
          |
        >>> incorrect component size for atomic components
        >>> only allowed value is 8

    16.
    17.   type Arr4 is array (1 .. 16) of My_Boolean;
    18.   pragma Pack (Arr4);
          |
        >>> cannot pack atomic components

    19.
    20. end P;

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-01-07  Eric Botcazou  <ebotcazou@adacore.com>

	* freeze.adb (Freeze_Array_Type): Apply same handling to Is_Atomic
	component type as to Has_Atomic_Components type.  Remove useless
	test on Is_Aliased component type.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]