[Bug ada/78066] New: Misleading error message about redundant Dynamic_Predicate incorrectly mentions "Valid"
georggcc at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 21 12:17:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78066
Bug ID: 78066
Summary: Misleading error message about redundant
Dynamic_Predicate incorrectly mentions "Valid"
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: georggcc at googlemail dot com
Target Milestone: ---
Host: x86_64-apple-darwin15
Target: x86_64-apple-darwin15
Build: x86_64-apple-darwin15
The exact repetition of the range constraint on type T
in its Dynamic_Predicate leads to infinite recursion.
This is as predicted by a warning. However, the warning mentions
attribute Valid, whereas the source has a membership test.
Also, the workaround shown in the commented line seems to be
checking membership in the same set of values, but compilation
and program do not exhibit the same behavior.
(Is infinite recursion acceptable behavior when constraint
and Dynamic_Predicate are identical?)
procedure Test_Redundant_Predicate is
type T is range 1 .. 10
with
Dynamic_Predicate => T in 1 .. 10;
-- Dynamic_Predicate => T = 1 or T in 2 .. 10;
X : T;
begin
X := 3;
end Test_Redundant_Predicate;
gcc -c -gnatwa -gnata -gnat2012 test_redundant_predicate.adb
test_redundant_predicate.adb:5:30: warning: attribute Valid requires a
predicate check
test_redundant_predicate.adb:5:30: warning: and will result in infinite
recursion
(Confirming that it does raise:
$ ./test_redundant_predicate
raised STORAGE_ERROR : stack overflow)
More information about the Gcc-bugs
mailing list