public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66578] [F2008] Invalid free on allocate(...,source=a(:)) in block
Date: Fri, 19 Jun 2015 06:24:00 -0000	[thread overview]
Message-ID: <bug-66578-4-dzHSYMMqCU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66578-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66578

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #8)
> diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
> index fece3ab..0b96de1 100644
> --- a/gcc/fortran/trans-array.c
> +++ b/gcc/fortran/trans-array.c
> @@ -7079,7 +7077,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
>  	    {
>  	      tmp = gfc_conv_array_lbound (desc, n);
>  	      tmp = fold_build2_loc (input_location, MINUS_EXPR,
> -				     TREE_TYPE (base), tmp, loop.from[dim]);
> +				     TREE_TYPE (base), tmp, from);
>  	      tmp = fold_build2_loc (input_location, MULT_EXPR,
>  				     TREE_TYPE (base), tmp,
>  				     gfc_conv_array_stride (desc, n));

Unfortunately, this does not appear to fix the bug (at least not completely).
I still get an invalid free.
>From gcc-bugs-return-489367-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jun 19 06:42:12 2015
Return-Path: <gcc-bugs-return-489367-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18121 invoked by alias); 19 Jun 2015 06:42:11 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18071 invoked by uid 48); 19 Jun 2015 06:42:06 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero.
Date: Fri, 19 Jun 2015 06:42: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: 5.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
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: <bug-64130-4-pfCGlugtx0@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64130-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64130-4@http.gcc.gnu.org/bugzilla/>
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-06/txt/msg01699.txt.bz2
Content-length: 839

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd130

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to kugan from comment #5)
> I think it should be in from front-end?

?

> Tried fixing it in VRP like:

You don't seem to use ranges at all. This might be the right place to implement
the suggestion from comment #2 (though if it does not use ranges, match.pd
would be better), but for the original optimization, what you want to improve
is the computation of the range of a division. When a has range [0, 4294967295]
we compute for 2305843009213693951 / a the range [0, 2305843009213693951] which
is not optimal, the left bound should be 536870912 not 0. If the good interval
is computed, VRP will automatically fold == 0 to false without extra code. We
already get this right when a has range [1, 4294967295].


  parent reply	other threads:[~2015-06-19  6:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 19:29 [Bug fortran/66578] New: " tkoenig at gcc dot gnu.org
2015-06-17 19:31 ` [Bug fortran/66578] " tkoenig at gcc dot gnu.org
2015-06-17 20:49 ` dominiq at lps dot ens.fr
2015-06-18  9:37 ` vehre at gcc dot gnu.org
2015-06-18 14:32 ` vehre at gcc dot gnu.org
2015-06-18 17:14 ` tkoenig at gcc dot gnu.org
2015-06-18 18:03 ` vehre at gcc dot gnu.org
2015-06-18 18:17 ` mikael at gcc dot gnu.org
2015-06-19  6:24 ` tkoenig at gcc dot gnu.org [this message]
2015-06-19  9:06 ` mikael at gcc dot gnu.org
2015-06-19  9:45 ` vehre at gcc dot gnu.org
2015-06-21 19:03 ` mikael at gcc dot gnu.org
2015-06-21 20:11 ` tkoenig at gcc dot gnu.org
2015-06-22 11:29 ` vehre at gcc dot gnu.org
2015-07-01 14:24 ` vehre at gcc dot gnu.org
2015-07-07 11:10 ` vehre at gcc dot gnu.org
2015-07-09 10:43 ` vehre at gcc dot gnu.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=bug-66578-4-dzHSYMMqCU@http.gcc.gnu.org/bugzilla/ \
    --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: link
Be 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).