This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Warning on self-assignment to formal


The compiler failed to warn on a useless self-assignment when the entity was
an in-out parameter. because the predicate Same_Object.ignored formals.

The following must generate the warning:
proc.adb:5:09: warning: useless assignment of "X" to itself

gcc -c -gnatwr proc.adb

---
procedure Proc (X : in out Integer) is
begin
   X := 15;
   if X > 0 then
      X := X;
   end if;
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-09-09  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Same_Object): include formal parameters.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]