From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29695 invoked by alias); 3 Nov 2010 17:34:16 -0000 Received: (qmail 29619 invoked by uid 22791); 3 Nov 2010 17:34:14 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Nov 2010 17:34:10 +0000 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/43310] -pedantic errors involving PARAMETERs and out of range result X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 03 Nov 2010 17:34:00 -0000 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: 2010-11/txt/msg00392.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #14 from kargl at gcc dot gnu.org 2010-11-03 17:33:59 UTC --- (In reply to comment #13) > (In reply to comment #11) > > > Well, the number model is symmetric. See Fortran 2003 ... > > > > I agree, but it is a very pedantic view that should at least be mentioned in > > the manual. > > You forgot to attach your patch. > > > Now I think the implementation is not consistent: > > > > [macbook] f90/bug% cat > ishft_1.f90 > > print *, ishft(1,31) > > end > > [macbook] f90/bug% gfc -Wall -pedantic ishft_1.f90 > > [macbook] f90/bug% a.out > > -2147483648 > > gfc_simplify_ishft doesn't range check its result. > Patch welcomed. laptop:kargl[210] gfc4x -o z t.f90 laptop:kargl[211] ./z -2147483648 laptop:kargl[212] gfc4x -o z -pedantic t.f90 t.f90:1.14: print*, ishft(1,31) 1 Error: Result of ISHFT gives range error for its kind at (1) Index: simplify.c =================================================================== --- simplify.c (revision 166091) +++ simplify.c (working copy) @@ -3002,7 +3002,7 @@ simplify_shift (gfc_expr *e, gfc_expr *s convert_mpz_to_signed (result->value.integer, bitsize); gfc_free (bits); - return result; + return range_check (result, name); }