r273352 - in /trunk/gcc: ada/ChangeLog ada/sem_...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Wed Jul 10 09:02:00 GMT 2019


Author: pmderodat
Date: Wed Jul 10 09:02:55 2019
New Revision: 273352

URL: https://gcc.gnu.org/viewcvs?rev=273352&root=gcc&view=rev
Log:
[Ada] Spurious run-time error with 64-bit modular types

As a lexical element an integer literal has type Universal_Integer, i.e
is compatible with any integer type. This is semantically consistent and
simplifies type checking and subsequent constant folding when
applicable.  An exception is caused by 64-bit modular types, whose upper
bound is not representable in a non-static context that will use 64-bit
integers at run-time. For such cases we need to preserve the information
that the analyzed literal has that modular type. For simplicity we
preseve the information for all integer literals that result from a
modular operation.  This happens after prior analysis (or construction)
of the literal, and after type checking and resolution.

2019-07-10  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch2.adb (Analyze_Integer_Literal): Preserve the type of
	the literal if prior analysis determined that its type is a
	modular integer type.

gcc/testsuite/

	* gnat.dg/modular5.adb: New testcase.

Added:
    trunk/gcc/testsuite/gnat.dg/modular5.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_ch2.adb
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list