From: TPCnospam@mklab.ph.rhul.ac.uk
To: gcc-help@gcc.gnu.org
Cc: tom@mklab.ph.rhul.ac.uk (Tom Crane)
Subject: subl $<large number>, %esp related segfault
Date: Wed, 25 Aug 2004 23:47:00 -0000 [thread overview]
Message-ID: <200408252045.i7PKjcEG025776@mklab.ph.rhul.ac.uk> (raw)
Dear All,
I am getting segfaults in a FORTRAN program compiled with g95
under Linux/i386 but the problem is not specific to g95. I can simulate
it with g77 which similarly uses gcc's assembler generation routines. It
is just that I have some quite large subroutines (originally Fortran 77)
which been trivially converted to use a derived datatype under g95 which
has the effect of substantially increasing the code size and memory usage
-- to the extent that the problem I'm describing occurs. The problem
subroutines are part of a set of similar, numerically intensive ones, most
of which work fine. It is just the few biggest ones which have this
problem. Here is some assembler O/P from g95 for a problem subroutine.
.type fo7dma0dmc0_, @function
fo7dma0dmc0_:
.LFB93:
.loc 1 1 0
pushl %ebp
.LCFI315:
movl %esp, %ebp
.LCFI316:
pushl %edi
.LCFI317:
pushl %esi
.LCFI318:
pushl %ebx
.LCFI319:
subl $9389456, %esp
.LCFI320:
.loc 2 20 0
.LBB47:
pushl $3
pushl $.LC0
etc. etc.
Here is my analysis: The 'subl $9389456, %esp' pulls the stack pointer
down by that large number. When the 'pushl $3' tries to execute it
overflows the stack and gets a segfault. My FORTRAN code uses static
allocation. The thing I don't understand is; what precisely is the subl's
purpose? Is there a way to reduce its size? eg. a compiler option. I'm
reluctant to try splitting the subroutine up into two smaller ones.
Any other ideas?
Thanks
Tom.
Ps. Where can I find a description of GNU/Linux procedure calling
standard?
--
Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill,
Egham, Surrey, TW20 0EX, England.
Email: T.Crane@rhul.ac.uk
Fax: +44 (0) 1784 472794
next reply other threads:[~2004-08-25 20:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-25 23:47 TPCnospam [this message]
2004-08-26 7:28 ` Arno Wilhelm
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=200408252045.i7PKjcEG025776@mklab.ph.rhul.ac.uk \
--to=tpcnospam@mklab.ph.rhul.ac.uk \
--cc=gcc-help@gcc.gnu.org \
--cc=tom@mklab.ph.rhul.ac.uk \
/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).