[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.
From-SVN: r273352