From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45389 invoked by alias); 10 Sep 2015 21:45:25 -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 Received: (qmail 45323 invoked by uid 48); 10 Sep 2015 21:45:21 -0000 From: "fxcoudert at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/67531] FAIL: gfortran.dg/ieee/large_2.f90 -O0 execution test Date: Thu, 10 Sep 2015 21:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fxcoudert at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00900.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67531 --- Comment #3 from Francois-Xavier Coudert = --- (In reply to Pat Haugen from comment #2) > pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc z.c -lm && ./a.out > 0.3333333333333333333333333333333353876586 > 0.3333333333333333333333333333333292246827 How about with this? I'm trying to come as close as possible to the exact sequence of fe.etround() calls as the Fortran front-end and runtime library would end up performing=E2=80=A6 #include #include int main (void) { int r; long double x1, x2, x; x1 =3D 1; x =3D 3; r =3D fegetround (); fesetround (FE_UPWARD); x1 =3D x1 / x; fesetround (r); x2 =3D 1; x =3D 3; r =3D fegetround (); fesetround (FE_DOWNWARD); x2 =3D x2 / x; fesetround (r); printf ("%.40Lg\n", x1); printf ("%.40Lg\n", x2); } >>From gcc-bugs-return-496923-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Sep 10 21:52:57 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 70526 invoked by alias); 10 Sep 2015 21:52:57 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 70460 invoked by uid 48); 10 Sep 2015 21:52:54 -0000 From: "pangbw at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59124] [4.9/5/6 Regression] Wrong warnings "array subscript is above array bounds" Date: Thu, 10 Sep 2015 21:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.3 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pangbw at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00901.txt.bz2 Content-length: 1339 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124 --- Comment #19 from baoshan --- I did a little investigation to the code: The warning occurs because tree_int_cst_lt (up_bound, up_sub) is true here: else if (TREE_CODE (up_sub) == INTEGER_CST && (ignore_off_by_one ? (tree_int_cst_lt (up_bound, up_sub) && !tree_int_cst_equal (up_bound_p1, up_sub)) : (tree_int_cst_lt (up_bound, up_sub) || tree_int_cst_equal (up_bound_p1, up_sub)))) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Array bound warning for "); dump_generic_expr (MSG_NOTE, TDF_SLIM, ref); fprintf (dump_file, "\n"); } warning_at (location, OPT_Warray_bounds, => "array subscript is above array bounds"); TREE_NO_WARNING (ref) = 1; } I dumped the tree up_bound and up_sub: (gdb) p debug_tree(up_bound) constant 5> p debug_tree(up_sub) constant 4294967291> We can see the value of up_sub is represented as unsigned int value 4294967291 which is really weird to me, it suppose to be a int value -5 here.