public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "paul.richard.thomas at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47592] Multiple function invocation with ALLOCATE (SOURCE=REPEAT('x',bar())) Date: Thu, 03 Feb 2011 07:43:00 -0000 [thread overview] Message-ID: <bug-47592-4-DBFUgT4Cag@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-47592-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47592 --- Comment #1 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> 2011-02-03 07:43:13 UTC --- Hi Thomas, I was aware of the potential for functions with side effects to screw up ALLOCATE with source. I believe that one can persuade the same thing to happen with array constructors, although I have not tried it. > ig25@linux-fd1f:/tmp> gfortran foo.f90 > ig25@linux-fd1f:/tmp> ./a.out > 12 > > The output should be 11. Could you post a PR on this, please? > Paul, the cleanest way to resolve this would be to replace the call > to gfc_copy_expr in your recent patch with a new function which > goes something like this (incomplete and untested...) > > void gfc_freeze_expression (gfc_expr *oe, gfc_expr *ne, gfc_code **c) > { > if (oe->expr_type == EXPR_CONSTANT || oe->expr_type == EXPR_VARIABLE) > { > ne = gfc_copy_expr (oe); > return; > } > /* Create a new variable with the same type as oe, > create an assignment where oe is assigned to that > variable and insert it before the current statement, > then replace oe with that variable. */ > } > > This is a function that I've been meaning to write for the > front end passes for some time... We have tended to use EXPR_PARENTHESES to achieve the same thing. It will not work here, however. This gets dangerously close to something that I have had in mind for a long time - to do scalarization in the front end. ***sigh*** I feel like the White Rabbit in the opening scene in Alice in Wonderland! Cheers Paul
next prev parent reply other threads:[~2011-02-03 7:43 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-02 22:38 [Bug fortran/47592] New: " tkoenig at gcc dot gnu.org 2011-02-03 7:43 ` paul.richard.thomas at gmail dot com [this message] 2011-02-03 21:10 ` [Bug fortran/47592] " pault at gcc dot gnu.org 2011-02-06 14:25 ` pault at gcc dot gnu.org 2011-02-06 15:07 ` pault 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-47592-4-DBFUgT4Cag@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).