public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/30512] MAXVAL() incorrect for zero-size int arrays, and for -HUGE-1 maximum values. Date: Sat, 20 Jan 2007 12:46:00 -0000 [thread overview] Message-ID: <20070120124643.22154.qmail@sourceware.org> (raw) In-Reply-To: <bug-30512-13350@http.gcc.gnu.org/bugzilla/> ------- Comment #2 from burnus at gcc dot gnu dot org 2007-01-20 12:46 ------- Non-library part of this fix. This fixes the reported bug, but libgfortran/m4/* should be fixed as well. m4/iparm.m4 contains: define(atype_max, atype_name`_HUGE')dnl define(atype_min, `-'atype_max)dnl One would need to put an "ifelse" for atype_min, but I'm rather illiterate in m4. Index: trans-intrinsic.c =================================================================== --- trans-intrinsic.c (Revision 120999) +++ trans-intrinsic.c (Arbeitskopie) @@ -1976,11 +1976,16 @@ gcc_unreachable (); } - /* Most negative(+HUGE) for maxval, most negative (-HUGE) for minval. */ + /* Most negative(-HUGE) for maxloc, most positiv (+HUGE) for minloc. */ if (op == GT_EXPR) tmp = fold_build1 (NEGATE_EXPR, TREE_TYPE (tmp), tmp); gfc_add_modify_expr (&se->pre, limit, tmp); + /* Most negative for BT_INTEGER is -HUGE-1. */ + if (op == GT_EXPR && expr->ts.type == BT_INTEGER) + tmp = build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp, + build_int_cst (type, 1)); + /* Initialize the scalarizer. */ gfc_init_loopinfo (&loop); gfc_add_ss_to_loop (&loop, arrayss); @@ -2135,9 +2140,15 @@ gcc_unreachable (); } - /* Most negative(-HUGE) for maxval, most positive (-HUGE) for minval. */ + /* Most negative(-HUGE) for maxval, most positive (+HUGE) for minval. */ if (op == GT_EXPR) tmp = fold_build1 (NEGATE_EXPR, TREE_TYPE (tmp), tmp); + + /* Most negative for BT_INTEGER is -HUGE-1. */ + if (op == GT_EXPR && expr->ts.type == BT_INTEGER) + tmp = build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp, + build_int_cst (type, 1)); + gfc_add_modify_expr (&se->pre, limit, tmp); /* Walk the arguments. */ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30512
next prev parent reply other threads:[~2007-01-20 12:46 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-01-20 0:10 [Bug fortran/30512] New: " brooks at gcc dot gnu dot org 2007-01-20 9:38 ` [Bug fortran/30512] " burnus at gcc dot gnu dot org 2007-01-20 12:46 ` burnus at gcc dot gnu dot org [this message] 2007-01-22 7:56 ` fxcoudert at gcc dot gnu dot org 2007-01-22 8:47 ` burnus at gcc dot gnu dot org 2007-01-22 20:16 ` sgk at troutmask dot apl dot washington dot edu 2007-01-27 13:24 ` tkoenig at gcc dot gnu dot org 2007-01-28 22:39 ` tkoenig at gcc dot gnu dot org 2007-01-29 8:40 ` burnus at gcc dot gnu dot org 2007-01-30 17:58 ` burnus at gcc dot gnu dot org 2007-02-01 9:01 ` patchapp at dberlin dot org 2007-02-09 21:56 ` burnus at gcc dot gnu dot org 2007-02-16 14:16 ` [Bug fortran/30512] [4.2, 4.1 only] " burnus at gcc dot gnu dot org 2007-02-16 14:17 ` [Bug fortran/30512] [4.1 " burnus at gcc dot gnu dot org 2007-02-17 21:29 ` tkoenig at gcc dot gnu dot org 2007-02-20 17:39 ` burnus at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20070120124643.22154.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).