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 problems in error analysis for variant part


This patch fixes regressions caused by the previous checkin to
handle statically predicated subtypes in variant choices. Error
messages were not being given in full code generation mode.

The following should compile with the indicated errors in both
-gnatc and normal code generation mode.

     1. PROCEDURE Variant_Errors IS
     2.    SUBTYPE STATCHAR IS CHARACTER RANGE 'I' .. 'N';
     3.    TYPE REC1 (DISC : STATCHAR) IS
     4.       RECORD
     5.          CASE DISC IS
                 |
        >>> missing case value: 'K'
        >>> missing case value: 'N'

     6.             WHEN 'I' => NULL;
     7.             WHEN 'J' => NULL;
     8.             WHEN 'L' => NULL;
     9.             WHEN 'M' => NULL;
    10.          END CASE;
    11.       END RECORD;
    12. BEGIN
    13.    NULL;
    14. end Variant_Errors;

Note: this is abstracted from ACATS test B37309B

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

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

	* exp_ch3.adb (Expand_N_Variant_Part): Now null, expansion of
	last choice to others is moved to Freeze_Record_Type.
	* freeze.adb (Freeze_Record_Type): Expand last variant to others
	if necessary (moved here from Expand_N_Variant_Part

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]