diff options
author | Ed Schonberg <schonberg@adacore.com> | 2019-07-10 09:02:55 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-10 09:02:55 +0000 |
commit | 4669743bd255d2ab4ff33672e8843a914e5c1d35 (patch) | |
tree | 96e179791fdde784f987de9c6a842e0f35cd889c /gcc/fold-const.c | |
parent | ccba4bf136ef7012e7387119a86da56575802c4f (diff) | |
download | gcc-4669743bd255d2ab4ff33672e8843a914e5c1d35.zip gcc-4669743bd255d2ab4ff33672e8843a914e5c1d35.tar.gz gcc-4669743bd255d2ab4ff33672e8843a914e5c1d35.tar.bz2 |
[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
Diffstat (limited to 'gcc/fold-const.c')
0 files changed, 0 insertions, 0 deletions