From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7988 invoked by alias); 4 Mar 2008 21:15:32 -0000 Received: (qmail 6494 invoked by uid 48); 4 Mar 2008 21:14:48 -0000 Date: Tue, 04 Mar 2008 21:15:00 -0000 Subject: [Bug ada/35464] New: "warning: condition is always False" not issued inside generics X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ludovic at ludovic-brenta dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-03/txt/msg00261.txt.bz2 With -gnatwa, GNAT emits very useful warnings; one of them is "condition is always False". However, GNAT does not emit this warning when it applies inside a generic, or a generic instantiation. The following test case demonstrates the problem. procedure Condition_Is_Always_False is type T is range 3 .. 4; function F return T is begin return T'First; end F; procedure OK is C : constant T := F; begin if C = 1 then -- warning: condition is always False null; end if; end OK; generic procedure NOK_G; procedure NOK_G is C : constant T := F; -- T'First instead of F gives the warning begin if C = 1 then -- no warning null; end if; end NOK_G; procedure NOK is new NOK_G; begin -- Condition_Is_Always_False OK; NOK; end Condition_Is_Always_False; gcc-4.1 -c -gnatwa condition_is_always_false.adb condition_is_always_false.adb:13:12: warning: condition is always False gnatbind -x condition_is_always_false.ali gnatlink condition_is_always_false.ali If, however, C is initialized directly with T'First (a static value) instead of the result of F (a static function), GNAT gives the warning even inside the generic. -- Summary: "warning: condition is always False" not issued inside generics Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ludovic at ludovic-brenta dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35464