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] Properly check violations of machine scalar rules


(RM 13.4.1(10)) for bids certain record component clauses when the
opposite bit order is in effect. The compiler was not properly checking
these cases.

The following shows the correct messages from violating these rules
(compiled with -gnatld7 -gnatj69 -gnat05)

     1. with System; use System;
     2. package testms is
     3.    type R is record
     4.       a : integer;
     5.       b : integer;
     6.    end record;
     7.    for R'Bit_Order use
     8.      Bit_Order'Val (1 - Bit_Order'Pos (Default_Bit_Order));
     9.    for R use record
    10.       a at 0 range 60 .. 91;
                           |
        >>> machine scalar rules not followed for "a", last bit (91)
            exceeds maximum machine scalar size (64), and is not a
            multiple of Storage_Unit (8) (RM 13.4.1(10))

    11.       b at 12 range 64 .. 127;
                            |
        >>> machine scalar rules not followed for "b", last bit
            (127) exceeds maximum machine scalar size (64), and
            first bit (64) is non-zero (RM 13.4.1(10))

    12.    end record;
    13. end testms;

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

2010-10-26  Robert Dewar  <dewar@adacore.com>

	* sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Properly check
	RM 13.4.1(10).

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]