aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 14:56:34 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 14:56:34 +0200
commita267d8ccb7df8b87c9f8680a32ea4530c86a600e (patch)
tree740cce6ad93536544617996dd0b2b928b1dab54c /gcc/ada/sem_res.adb
parent241f328c235be95a49c25681af0ccd34985560e1 (diff)
downloadgcc-a267d8ccb7df8b87c9f8680a32ea4530c86a600e.zip
gcc-a267d8ccb7df8b87c9f8680a32ea4530c86a600e.tar.gz
gcc-a267d8ccb7df8b87c9f8680a32ea4530c86a600e.tar.bz2
[multiple changes]
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch6.adb, sem_ch13.adb, sem_ch6.adb: Minor reformatting. 2017-04-25 Bob Duff <duff@adacore.com> * sem_res.adb (Resolve_Actuals): Under -gnatd.q, reset Is_True_Constant for an array variable that is passed to a foreign function as an 'in' parameter. * debug.adb: Document -gnatd.q. From-SVN: r247218
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 2a8010d..4afba9e 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4211,6 +4211,21 @@ package body Sem_Res is
end if;
end if;
+ -- In -gnatd.q mode, forget that a given array is constant when
+ -- it is passed as an IN parameter to a foreign-convention
+ -- subprogram. This is in case the subprogram evilly modifies the
+ -- object. Of course, correct code would use IN OUT.
+
+ if Debug_Flag_Dot_Q
+ and then Ekind (F) = E_In_Parameter
+ and then Has_Foreign_Convention (Nam)
+ and then Is_Array_Type (F_Typ)
+ and then Nkind (A) in N_Has_Entity
+ and then Present (Entity (A))
+ then
+ Set_Is_True_Constant (Entity (A), False);
+ end if;
+
-- Case of OUT or IN OUT parameter
if Ekind (F) /= E_In_Parameter then