public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/49993] arrays declared as parameter are not allocated in read-only memory
Date: Mon, 08 Aug 2011 15:05:00 -0000	[thread overview]
Message-ID: <bug-49993-4-Jt5EjwcOdx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49993-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49993

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org 2011-08-08 15:05:10 UTC ---
(In reply to comment #1)
> The equivalent "C" program results in the expected "segmentation fault".
> 
> void a1(int *ia) {
>   *ia = 1;
> }
> void a2(void) {
>   static const int ia[] = { 2 };
>   a1(ia);
> }
> int main(void) {
>   a2();
>   return 0;
> }

The programs aren't equivalent.  You need to change a2 to

void a2(void) {
  static int ia[] = { 2 };
  a1(ia);
}

then the programs are equivalent.


  parent reply	other threads:[~2011-08-08 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 17:32 [Bug fortran/49993] New: " arnaud02 at users dot sourceforge.net
2011-08-08 10:28 ` [Bug fortran/49993] " arnaud02 at users dot sourceforge.net
2011-08-08 15:05 ` kargl at gcc dot gnu.org [this message]
2011-08-09 20:25 ` arnaud02 at users dot sourceforge.net
2011-11-04 10:35 ` arnaud02 at users dot sourceforge.net
2011-11-04 11:00 ` burnus 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-49993-4-Jt5EjwcOdx@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).