diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-07-22 13:56:50 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-22 13:56:50 +0000 |
commit | f3d2fbfdb83bcc60d72824daf7a470c0e5398854 (patch) | |
tree | ced0090a1981e3808c919aa6723cdb5351d1a48c /gcc/ada | |
parent | 1a79e03b8012d5094e5bd432df59abeca5c2fe18 (diff) | |
download | gcc-f3d2fbfdb83bcc60d72824daf7a470c0e5398854.zip gcc-f3d2fbfdb83bcc60d72824daf7a470c0e5398854.tar.gz gcc-f3d2fbfdb83bcc60d72824daf7a470c0e5398854.tar.bz2 |
[Ada] Fix spurious loop warning for function with Out parameter
The compiler gives a spurious warning about a possible infinite while
loop whose condition contains a call to a function that takes an Out or
In/Out parameter and whose actual is a variable that is not modified in
the loop, because it still thinks that functions can only have In
parameters.
2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_warn.adb (Find_Var): Bail out for a function call with an
Out or In/Out parameter.
gcc/testsuite/
* gnat.dg/warn23.adb: New testcase.
From-SVN: r273673
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_warn.adb | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ec1b81a..6fc9d1c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-07-22 Eric Botcazou <ebotcazou@adacore.com> + + * sem_warn.adb (Find_Var): Bail out for a function call with an + Out or In/Out parameter. + 2019-07-22 Nicolas Roche <roche@adacore.com> * terminals.c (__gnat_tty_waitpid): Support both blocking and diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 16a772a..0e1e292 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -333,6 +333,11 @@ package body Sem_Warn is elsif Has_Warnings_Off (Entity (Name (N))) then return; + + -- Forget it if the parameter is not In + + elsif Has_Out_Or_In_Out_Parameter (Entity (Name (N))) then + return; end if; -- OK, see if we have one argument |