public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: dominiq@lps.ens.fr (Dominique Dhumieres)
To: paul.richard.thomas@gmail.com, dominiq@lps.ens.fr
Cc: matz@suse.de, gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org
Subject: Re: Implement stack arrays even for unknown sizes
Date: Sun, 10 Apr 2011 13:29:00 -0000	[thread overview]
Message-ID: <20110410132925.5B1493BE18@mailhost.lps.ens.fr> (raw)
In-Reply-To: <BANLkTikwa8es+FxG2ThwWMo4MFGWVeddvg@mail.gmail.com>

> I find that both nf.f90 and capacita.f90 segfault in runtime for any stack size.

On x86_64-apple-darwin10, nf.f90 "works". However if I run it through
valgrind I get

==64815== Memcheck, a memory error detector
==64815== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==64815== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==64815== Command: a.out --max-stackframe=2118496
==64815==
==64815== Warning: set address range perms: large range [0x7ffe6c000000, 0x7fff5bc01000) (defined)
==64815== Warning: client switching stacks?  SP change: 0x7fff5bffe410 --> 0x7fff5be0cef0
==64815==          to suppress, use: --max-stackframe=2037024 or greater
==64815== Invalid write of size 8
==64815==    at 0x100003B22: nf2dprecon.1828 (nf.f90:262)
==64815==    by 0x10000C3B6: nfcg_ (nf.f90:279)
==64815==    by 0x3FEFFFFFFFFFFFFF: ???
==64815==    by 0x3FEFFFFFFFFFFFFF: ???
==64815==  Address 0x7fff5be0cee8 is on thread 1's stack
==64815==
==64815== Invalid read of size 8
==64815==    at 0x100001296: trisolve.1839 (nf.f90:238)
==64815==    by 0x10000C3B6: nfcg_ (nf.f90:279)
==64815==    by 0x3FEFFFFFFFFFFFFF: ???
==64815==    by 0x3FEFFFFFFFFFFFFF: ???
==64815==  Address 0x7fff5be0cee8 is on thread 1's stack
==64815==
...
==64815== Invalid write of size 8
==64815==    at 0x100000F38: trisolve.1839 (nf.f90:231)
==64815==    by 0x10000C3B6: nfcg_ (nf.f90:279)
==64815==    by 0x3FEFFFFFFFFFFFFF: ???
==64815==    by 0x3FEFFFFFFFFFFFFF: ???
==64815==  Address 0x7fff5bffdde8 is on thread 1's stack
==64815==
==64815== Invalid read of size 8
==64815==    at 0x100000F64: trisolve.1839 (nf.f90:233)
==64815==    by 0xC02396760B69D62B: ???
==64815==    by 0xC02396760B69D62C: ???
==64815==    by 0xC02396760B69D62D: ???
==64815==    by 0xC02396760B69D62D: ???
==64815==    by 0xC02396760B69D62D: ???
==64815==    by 0xC02396760B69D62D: ???
==64815==    by 0xC02396760B69D62D: ???
==64815==    by 0xC02396760B69D62D: ???
==64815==    by 0xC02396760B69D62B: ???
==64815==    by 0xC02396760B69D62B: ???
==64815==    by 0xC02396760B69D62B: ???
==64815==  Address 0x7fff5bffdde8 is on thread 1's stack
==64815==
...
 Time for setup          1.316
 Time per iteration      3.250
 Total Time            144.295
==64815==
==64815== HEAP SUMMARY:
==64815==     in use at exit: 656 bytes in 13 blocks
==64815==   total heap usage: 411 allocs, 398 frees, 387,314,592 bytes allocated
==64815==
==64815== LEAK SUMMARY:
==64815==    definitely lost: 0 bytes in 0 blocks
==64815==    indirectly lost: 0 bytes in 0 blocks
==64815==      possibly lost: 0 bytes in 0 blocks
==64815==    still reachable: 656 bytes in 13 blocks
==64815==         suppressed: 0 bytes in 0 blocks
==64815== Rerun with --leak-check=full to see details of leaked memory
==64815==
==64815== For counts of detected and suppressed errors, rerun with: -v
==64815== ERROR SUMMARY: 40050 errors from 1000 contexts (suppressed: 0 from 0)

The segfault for capacita.f90 occurs in the subroutine fourir at the line

            write(unit=*, fmt=*) "error in fourier: n=", ntot

AFAICT the problem occurs in the loop

      do m=1,ntot/4-1
        E(m) = exp(m*h)
      end do

If I print ntot, loc(ntot) before it I get

        2048      140734799794712

After the loop loc(ntot) is

              9205357642636066816

and any attemp to print its values yields a segfault.

Dominique

  reply	other threads:[~2011-04-10 13:29 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 10:08 Dominique Dhumieres
2011-04-09 12:17 ` Paul Richard Thomas
2011-04-10 13:29   ` Dominique Dhumieres [this message]
2011-04-11 11:49     ` Michael Matz
2011-04-11 11:58       ` Axel Freyn
2011-04-11 13:35       ` Eric Botcazou
2011-04-11 14:06         ` Dominique Dhumieres
2011-04-11 14:59         ` Michael Matz
2011-04-11 16:04   ` Michael Matz
2011-04-11 16:45     ` Steven Bosscher
2011-04-12 11:54       ` Michael Matz
2011-04-12 12:42         ` N.M. Maclaren
2011-04-11 16:46     ` Dominique Dhumieres
2011-04-11 16:59     ` H.J. Lu
2011-04-11 17:06       ` N.M. Maclaren
2011-04-11 18:28     ` Tobias Burnus
2011-04-11 21:18     ` Dominique Dhumieres
2011-04-12  6:23     ` Paul Richard Thomas
2011-04-12  6:35       ` Dominique Dhumieres
2011-04-13  9:42         ` Paul Richard Thomas
2011-04-13 10:38           ` Richard Guenther
2011-04-13 11:13             ` Richard Guenther
2011-04-14 13:32               ` Dominique Dhumieres
2011-04-13 13:46             ` Paul Richard Thomas
2011-04-14 13:59         ` Michael Matz
2011-04-14 15:28           ` Michael Matz
2011-04-14 19:29             ` Dominique Dhumieres
2011-04-15  2:01             ` Dominique Dhumieres
2011-04-15 12:38               ` Michael Matz
2011-04-15 14:06                 ` Dominique Dhumieres
2011-04-15 15:19                   ` Michael Matz
2011-04-15 15:26                     ` Jerry DeLisle
2011-04-15 22:41                       ` Michael Matz
2011-04-14 20:23     ` Tobias Burnus
2011-04-14 20:30       ` Tobias Burnus
  -- strict thread matches above, loose matches on Subject: below --
2011-04-08 21:29 Michael Matz
2011-04-09  8:21 ` N.M. Maclaren
2011-04-09  8:51   ` Magnus Fromreide
2011-04-09  9:02   ` Eric Botcazou
2011-04-09  9:49     ` N.M. Maclaren

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=20110410132925.5B1493BE18@mailhost.lps.ens.fr \
    --to=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=matz@suse.de \
    --cc=paul.richard.thomas@gmail.com \
    /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).