Signed-off-by: Jose E. Marchesi <[email protected]>
gcc/algol68/ChangeLog
* a68-parser-victal.cc (victal_check_mode_dec): Mind publicized
declarations.
(victal_check_variable_dec): Likewise.
(victal_check_identity_dec): Likewise.
gcc/testsuite/ChangeLog
* algol68/compile/actual-bounds-expected-4.a68: New test.
* algol68/compile/formal-bounds-expected-1.a68: Likewise.
---
gcc/algol68/a68-parser-victal.cc | 10 +++++++++-
.../algol68/compile/actual-bounds-expected-4.a68 | 15 +++++++++++++++
.../algol68/compile/formal-bounds-expected-1.a68 | 5 +++++
3 files changed, 29 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/algol68/compile/actual-bounds-expected-4.a68
create mode 100644 gcc/testsuite/algol68/compile/formal-bounds-expected-1.a68
diff --git a/gcc/algol68/a68-parser-victal.cc b/gcc/algol68/a68-parser-victal.cc
index b4162fc3982..a810d385555 100644
--- a/gcc/algol68/a68-parser-victal.cc
+++ b/gcc/algol68/a68-parser-victal.cc
@@ -90,6 +90,10 @@ victal_check_mode_dec (NODE_T *p)
victal_check_mode_dec (SUB (p));
victal_check_mode_dec (NEXT (p));
}
+ else if (IS (p, PUBLIC_SYMBOL))
+ {
+ victal_check_mode_dec (NEXT (p));
+ }
else if (a68_is_one_of (p, MODE_SYMBOL, DEFINING_INDICANT, STOP)
|| a68_is_one_of (p, EQUALS_SYMBOL, COMMA_SYMBOL, STOP))
{
@@ -117,6 +121,9 @@ victal_check_variable_dec (NODE_T *p)
}
else
{
+ if (IS (p, PUBLIC_SYMBOL))
+ FORWARD (p);
+
if (IS (p, QUALIFIER))
FORWARD (p);
@@ -147,7 +154,8 @@ victal_check_identity_dec (NODE_T * p)
victal_check_identity_dec (SUB (p));
victal_check_identity_dec (NEXT (p));
}
- else if (a68_is_one_of (p, DEFINING_IDENTIFIER, EQUALS_SYMBOL,
COMMA_SYMBOL, STOP))
+ else if (a68_is_one_of (p, PUBLIC_SYMBOL, DEFINING_IDENTIFIER,
EQUALS_SYMBOL, COMMA_SYMBOL,
+ STOP))
victal_check_identity_dec (NEXT (p));
else if (IS (p, UNIT))
a68_victal_checker (SUB (p));
diff --git a/gcc/testsuite/algol68/compile/actual-bounds-expected-4.a68
b/gcc/testsuite/algol68/compile/actual-bounds-expected-4.a68
new file mode 100644
index 00000000000..9be3c9b4c5d
--- /dev/null
+++ b/gcc/testsuite/algol68/compile/actual-bounds-expected-4.a68
@@ -0,0 +1,15 @@
+{ Check that the victal pass handles publicized mode declarations
+ properly. }
+
+module Foo =
+def pub mode M1 = ref[]int;
+ pub mode M2 = []int; { dg-error "actual bounds expected" }
+ mode M3 = []real; { dg-error "actual bounds expected" }
+ pub []int v1; { dg-error "actual bounds expected" }
+ []int v2; { dg-error "actual bounds expected" }
+ pub []int a1 = ([]int v; v); { dg-error "actual bounds expected" }
+ []int a2 = ([]int v; v); { dg-error "actual bounds expected" }
+ pub op - = ([3]int a) int: skip; { dg-error "formal bounds expected" }
+ op + = ([3]int a) int: skip; { dg-error "formal bounds expected" }
+ skip
+fed
diff --git a/gcc/testsuite/algol68/compile/formal-bounds-expected-1.a68
b/gcc/testsuite/algol68/compile/formal-bounds-expected-1.a68
new file mode 100644
index 00000000000..a645f54cae0
--- /dev/null
+++ b/gcc/testsuite/algol68/compile/formal-bounds-expected-1.a68
@@ -0,0 +1,5 @@
+module Foo =
+def pub op - = ([3]int a) int: skip; { dg-error "formal bounds expected" }
+ op + = ([3]int a) int: skip; { dg-error "formal bounds expected" }
+ skip
+fed
--
2.30.2