aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2016-05-02 09:44:54 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2016-05-02 11:44:54 +0200
commitc4405dfe1ddddff2f5635e3d220c5c59a4c61a92 (patch)
treea773971596477f3017235cfecf947dc7603070bd /gcc
parent05ff4c5fa71037322916d2936dce3f762357c647 (diff)
downloadgcc-c4405dfe1ddddff2f5635e3d220c5c59a4c61a92.zip
gcc-c4405dfe1ddddff2f5635e3d220c5c59a4c61a92.tar.gz
gcc-c4405dfe1ddddff2f5635e3d220c5c59a4c61a92.tar.bz2
sem_util.adb (Normalize_Actuals): Take into account extra actuals that may have been introduced previously.
2016-05-02 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Normalize_Actuals): Take into account extra actuals that may have been introduced previously. Normally extra actuals are introduced when a call is expanded, but a validity check may copy and reanalyze a call that carries an extra actual (e.g. an accessibility parameter) before the call itself is marked Analzyed, and the analysis of the copy has to be able to cope with the added actual. From-SVN: r235723
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/sem_util.adb21
2 files changed, 28 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d05918c..72a1ae5 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,13 @@
+2016-05-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Normalize_Actuals): Take into account extra
+ actuals that may have been introduced previously. Normally extra
+ actuals are introduced when a call is expanded, but a validity
+ check may copy and reanalyze a call that carries an extra actual
+ (e.g. an accessibility parameter) before the call itself is
+ marked Analzyed, and the analysis of the copy has to be able to
+ cope with the added actual.
+
2016-05-02 Bob Duff <duff@adacore.com>
* sem_ch10.adb (Analyze_Compilation_Unit): Preserve
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 863ff30..4fc783f 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -17088,9 +17088,24 @@ package body Sem_Util is
and then Actual /= Last
and then No (Next_Named_Actual (Actual))
then
- Error_Msg_N ("unmatched actual & in call",
- Selector_Name (Actual));
- exit;
+ -- A validity check may introduce a copy of a call that
+ -- includes an extra actual (for example for an unrelated
+ -- accessibility check). Check that the extra actual matches
+ -- some extra formal, which must exist already because
+ -- subprogram must be frozen at this point.
+
+ if Present (Extra_Formals (S))
+ and then not Comes_From_Source (Actual)
+ and then Nkind (Actual) = N_Parameter_Association
+ and then Chars (Extra_Formals (S)) =
+ Chars (Selector_Name (Actual))
+ then
+ null;
+ else
+ Error_Msg_N
+ ("unmatched actual & in call", Selector_Name (Actual));
+ exit;
+ end if;
end if;
Next (Actual);