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] Duplicated index values are displayed for case statements


Duplicated index values are now displayed for case statement and
error flags for both duplicated and missing case values are placed
more precisely as shown by the compilation of the following test
compiled with -gnatj60.

     1. package dupaggr is
     2.    type enum is (a, b, c, d, e, f);
     3.    type ar is array (enum) of integer;
     4.    av1 : ar := (a      => 3,
     5.                 c .. d => 4,
                        |
        >>> missing index value in array aggregate
              "b"

     6.                 f      => 23);
                        |
        >>> missing index value in array aggregate
              "e"

     7.
     8.    av2 : ar := (a .. c => 4,
     9.                 b .. e => 10,
                        |
        >>> index values in array aggregate duplicate those
            given at line 8
              "b" .. "c"

    10.                 e .. f => 23);
                        |
        >>> index value in array aggregate duplicates the
            one given at line 9
              "e"

    11.
    12.    av3 : ar := (a .. c => 4,
    13.                 e      => 19,
                        |
        >>> missing index value in array aggregate
              "d"

    14.                 e .. f => 23);
                        |
        >>> index value in array aggregate duplicates the
            one given at line 13
              "e"

    15.
    16.    av4 : ar := (a      => 3, c.. d => 4, f      => 23);
                                     1           2
        >>> missing index value in array aggregate
              "b"
        >>> missing index value in array aggregate
              "e"

    17.
    18.    av5 : ar := (a .. c => 4, b .. e => 10, e .. f => 23);
                                     1             2
        >>> index values in array aggregate duplicate those
            given at line 18
              "b" .. "c"
        >>> index value in array aggregate duplicates the
            one given at line 18
              "e"

    19.
    20.    av6 : ar := (a .. b => 4, e      => 19, e .. f => 23);
                                     1             2
        >>> missing index values in array aggregate
              "c" .. "d"
        >>> index value in array aggregate duplicates the
            one given at line 20
              "e"

    21. end dupaggr;

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

2013-10-10  Robert Dewar  <dewar@adacore.com>

	* sem_aggr.adb (Resolve_Array_Aggregate): Identify duplicated
	cases.

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]