public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Joost.VandeVondele at mat dot ethz.ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57742] memset(malloc(n),0,n) -> calloc(n,1)
Date: Wed, 25 Jun 2014 07:41:00 -0000	[thread overview]
Message-ID: <bug-57742-4-oaKZnK2hIv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57742-4@http.gcc.gnu.org/bugzilla/>

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

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #18 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
The following now fails, so'll reopen this PR. It is at least related to
zeroing pvec twice in a row, and doesn seem to happen if I manually inline the
routine get_pseudo_param .

> cat bug.f90
MODULE atom_fit
  INTEGER, PARAMETER :: dp=8
CONTAINS
  SUBROUTINE atom_fit_pseudo ()
    REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: x, xi
    LOGICAL :: lsdpot
    ALLOCATE(xi(200),STAT=ierr)
    CALL get_pseudo_param(xi,lsdpot)
    CALL foo(xi)
  END SUBROUTINE atom_fit_pseudo
  SUBROUTINE get_pseudo_param (pvec,lsdpot)
    REAL(KIND=dp), DIMENSION(:), INTENT(out) :: pvec
    LOGICAL :: lsdpot
    IF(lsdpot) THEN
      pvec = 0
      pvec = 0
    END IF
  END SUBROUTINE get_pseudo_param
END MODULE atom_fit

> gfortran -c -O3 bug.f90
bug.f90: In function ‘atom_fit_pseudo’:
bug.f90:4:0: internal compiler error: Segmentation fault
   SUBROUTINE atom_fit_pseudo ()
 ^
0xa63a0f crash_signal
    ../../gcc/gcc/toplev.c:337
0x871f76 bb_seq_addr
    ../../gcc/gcc/gimple.h:1389
0x871f76 gsi_start_bb
    ../../gcc/gcc/gimple-iterator.h:118
0x871f76 gsi_for_stmt(gimple_statement_base*)
    ../../gcc/gcc/gimple-iterator.c:620
0xbfe1c1 handle_builtin_memset
    ../../gcc/gcc/tree-ssa-strlen.c:1653
0xbfe1c1 strlen_optimize_stmt
    ../../gcc/gcc/tree-ssa-strlen.c:1917
0xbfe1c1 strlen_dom_walker::before_dom_children(basic_block_def*)
    ../../gcc/gcc/tree-ssa-strlen.c:2096
0xfa483a dom_walker::walk(basic_block_def*)
    ../../gcc/gcc/domwalk.c:177
0xbf963d execute
    ../../gcc/gcc/tree-ssa-strlen.c:2170
Please submit a full bug report,
>From gcc-bugs-return-454844-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 25 07:44:04 2014
Return-Path: <gcc-bugs-return-454844-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31898 invoked by alias); 25 Jun 2014 07:44:04 -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 31860 invoked by uid 48); 25 Jun 2014 07:44:00 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57742] memset(malloc(n),0,n) -> calloc(n,1)
Date: Wed, 25 Jun 2014 07:44: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.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57742-4-ALdHeWXXln@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57742-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57742-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: 2014-06/txt/msg01926.txt.bz2
Content-length: 1486

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

--- Comment #19 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Joost VandeVondele from comment #17)
> Thanks Marc, I don't have write access, but I can try to dg-ify the testcase
> from comment #3.. however, first test, it still seems to contain a call to
> builtin_malloc at -O2, seems to work at -O3... expected ?

Yes, at -O2 you don't have a call to memset, so my patch does nothing. It is
the same as my C++ testcase basically, so we don't really need the extra
testcase.

> Also, my nightly CP2K tester fails with :
>
> 0xa63a0f crash_signal
>         ../../gcc/gcc/toplev.c:337
> 0x871f76 bb_seq_addr
>         ../../gcc/gcc/gimple.h:1389
> 0x871f76 gsi_start_bb
>         ../../gcc/gcc/gimple-iterator.h:118
> 0x871f76 gsi_for_stmt(gimple_statement_base*)
>         ../../gcc/gcc/gimple-iterator.c:620
> 0xbfe1c1 handle_builtin_memset
>         ../../gcc/gcc/tree-ssa-strlen.c:1653
> 0xbfe1c1 strlen_optimize_stmt
>         ../../gcc/gcc/tree-ssa-strlen.c:1917
> 0xbfe1c1 strlen_dom_walker::before_dom_children(basic_block_def*)
>         ../../gcc/gcc/tree-ssa-strlen.c:2096
> 0xfa483a dom_walker::walk(basic_block_def*)
>         ../../gcc/gcc/domwalk.c:177
> 0xbf963d execute
>         ../../gcc/gcc/tree-ssa-strlen.c:2170
> Please submit a full bug report,
>
> which I suppose is related to this patch... I'll see if I can get a testcase.

Yes, please open a new PR with the testcase and Cc: me, thanks.


  parent reply	other threads:[~2014-06-25  7:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 22:28 [Bug tree-optimization/57742] New: " glisse at gcc dot gnu.org
2013-10-11 16:44 ` [Bug tree-optimization/57742] " glisse at gcc dot gnu.org
2013-10-14  8:55 ` rguenth at gcc dot gnu.org
2013-10-14  9:51 ` Joost.VandeVondele at mat dot ethz.ch
2013-10-14 10:07 ` glisse at gcc dot gnu.org
2013-10-14 10:46 ` rguenth at gcc dot gnu.org
2013-10-14 11:48 ` glisse at gcc dot gnu.org
2013-10-14 20:51 ` glisse at gcc dot gnu.org
2013-10-14 20:53 ` glisse at gcc dot gnu.org
2013-10-15  7:57 ` rguenth at gcc dot gnu.org
2013-10-15 14:11 ` glisse at gcc dot gnu.org
2013-10-15 16:38 ` glisse at gcc dot gnu.org
2013-10-16 14:11 ` rguenth at gcc dot gnu.org
2014-02-22 15:44 ` glisse at gcc dot gnu.org
2014-02-23 18:46 ` glisse at gcc dot gnu.org
2014-06-24 19:04 ` glisse at gcc dot gnu.org
2014-06-25  6:46 ` Joost.VandeVondele at mat dot ethz.ch
2014-06-25  7:41 ` Joost.VandeVondele at mat dot ethz.ch [this message]
2014-06-25  7:53 ` glisse at gcc dot gnu.org
2014-06-25  8:09 ` glisse at gcc dot gnu.org
2014-06-25 12:27 ` glisse at gcc dot gnu.org
2014-06-25 12:29 ` glisse at gcc dot gnu.org
2015-09-17 19:32 ` daniel.gutson at tallertechnologies dot com

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-57742-4-oaKZnK2hIv@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).