diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2018-07-16 14:09:44 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-07-16 14:09:44 +0000 |
commit | 705bcbfeeccd0217f1764e9669ae727960563d24 (patch) | |
tree | 996e7ec40828441a661586fffa285a6d2f75d9c0 /gcc/ada/adaint.c | |
parent | e05a1ce7113ba87b45bb6c950a8ae0bf56c536e3 (diff) | |
download | gcc-705bcbfeeccd0217f1764e9669ae727960563d24.zip gcc-705bcbfeeccd0217f1764e9669ae727960563d24.tar.gz gcc-705bcbfeeccd0217f1764e9669ae727960563d24.tar.bz2 |
[Ada] Illegal deferred constant causes stack overflow
This patch prevents the compiler from entering infinite recursion when
processing an illegal deferred constant.
------------
-- Source --
------------
-- types.ads
package Types is
type Enum is (One, Two);
end Types;
-- types2.ads
with Types;
package Types2 is
type Enum is private;
One : constant Enum;
Two : constant Enum;
private
type Enum is new Types.Enum;
One : constant Enum := One;
Two : constant Enum := Two;
end Types2;
----------------------------
-- Compilation and output --
----------------------------
$ gcc -c types2.ads
types2.ads:10:04: full constant declaration appears too late
types2.ads:11:04: full constant declaration appears too late
2018-07-16 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* sem_eval.adb (Compile_Time_Known_Value): Add a guard which prevents
the compiler from entering infinite recursion when trying to determine
whether a deferred constant has a compile time known value, and the
initialization expression of the constant is a reference to the
constant itself.
From-SVN: r262698
Diffstat (limited to 'gcc/ada/adaint.c')
0 files changed, 0 insertions, 0 deletions