Add appropriate assertions to the operations in Uintp.  Most operations
disallow No_Uint. Division disallows Uint_0 on the right, and so on.

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

gcc/ada/

        * uintp.ads, uintp.adb: Add assertions.
        (Ubool, Opt_Ubool): New "boolean" subtypes.
        (UI_Is_In_Int_Range): The parameter should probably be
        Valid_Uint, but we don't change that for now, because it causes
        failures in gigi.
        * sem_util.ads, sem_util.adb (Is_True, Is_False,
        Static_Boolean): Use Opt_Ubool subtype.  Document the fact that
        Is_True (No_Uint) = True.  Implement Is_False in terms of
        Is_True.  We considered changing Static_Boolean to return Uint_1
        in case of error, but that doesn't fit in well with
        Static_Integer.
        (Has_Compatible_Alignment_Internal): Deal with cases where Offs
        is No_Uint. Change one "and" to "and then" to ensure we don't
        pass No_Uint to ">", which would violate the new assertions.
        * exp_util.adb, freeze.adb, sem_ch13.adb: Avoid violating new
        assertions in Uintp.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to