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
+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
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
+2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/warn23.adb: New testcase.
+
2019-07-22 Javier Miranda <miranda@adacore.com>
* gnat.dg/cpp_constructor2.adb: New testcase.
--- /dev/null
+-- { dg-do compile }
+
+procedure Warn23 is
+
+ type Enum_Type is (A, B, C);
+
+ function Poll (E : out Enum_Type) return Boolean
+ with Convention => Ada,
+ Import => True;
+
+ E : Enum_Type;
+
+begin
+ while Poll (E) loop
+ null;
+ end loop;
+end;