public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "strasbur at chkw386 dot ch.pwr.wroc.pl" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/58270] Wrong code while accessing array elements in a global structure Date: Mon, 02 Sep 2013 16:32:00 -0000 [thread overview] Message-ID: <bug-58270-4-7Kcs1mHM9u@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-58270-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58270 --- Comment #16 from Krzysztof Strasburger <strasbur at chkw386 dot ch.pwr.wroc.pl> --- Dear Dominique, I cannot agree with you. You are interpreting the code that may access the array beyond declared bounds as invalid, which is simply not true. As you pointed it out before, unnamed common block may be declared larger elsewhere, so writing the dmem array beyond its first element may be a design decision and therefore may be perfectly legal. The compiler has no clue about real size of unnamed common while compiling buggy.f and bounds checking is optional. I would also like to point it out that interpreting things this way you do, you exclude some older FORTRAN77 software (for example: quantum chemistry GAMESS), in which the lack of dynamic memory allocation was overcome using the trick we are discussing here (mixing with C was needed). BTW, change the size of dmem to 2 in buggy.f and things start to work correctly, although "out of bounds" memory accesses still do happen. The problem occurs only if dmem is of size 1. Of course you (developers) may decide to ignore this problem anyway, so if you do so, feel free to close this bug. I'm not going to reopen it again, because I'm out of arguments. I'm also not competent enough to tamper with the compiler.
next prev parent reply other threads:[~2013-09-02 16:32 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-08-29 10:48 [Bug c/58270] New: Wrong code accessing array elements strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 10:58 ` [Bug c/58270] Wrong code while accessing array elements in a global structure fweimer at redhat dot com 2013-08-29 11:15 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 11:29 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 12:19 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 12:21 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 12:23 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 12:39 ` mikpe at it dot uu.se 2013-08-29 13:32 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-08-29 14:48 ` jakub at gcc dot gnu.org 2013-08-29 16:23 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-09-02 8:20 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-09-02 8:24 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-09-02 12:21 ` [Bug fortran/58270] " dominiq at lps dot ens.fr 2013-09-02 13:14 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-09-02 14:39 ` dominiq at lps dot ens.fr 2013-09-02 16:32 ` strasbur at chkw386 dot ch.pwr.wroc.pl [this message] 2013-09-02 17:53 ` dominiq at lps dot ens.fr 2013-09-03 7:56 ` strasbur at chkw386 dot ch.pwr.wroc.pl 2013-09-03 9:23 ` [Bug middle-end/58270] Wrong code while accessing trailing array elements in a global common structure rguenth at gcc dot gnu.org 2013-09-03 9:41 ` dominiq at lps dot ens.fr 2013-09-03 9:48 ` dominiq at lps dot ens.fr 2021-11-29 2:32 ` pinskia 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-58270-4-7Kcs1mHM9u@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: linkBe 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).