public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51260] New: PARAMETER array with constructor initializer: Compile-time simplify single element access Date: Mon, 21 Nov 2011 22:01:00 -0000 [thread overview] Message-ID: <bug-51260-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51260 Bug #: 51260 Summary: PARAMETER array with constructor initializer: Compile-time simplify single element access Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org Missed optimization in several ways for: integer, parameter:: is(10000)=(/(i,i=1,10000)/) print *,is(1) end The main issue is that "is(1)" is not simplified into the constant "1". Expected: * The front end should already optimize is(1) to "1" and should not generate the variable to store the parameter. * One should somehow tell the middle end that only a single element is needed for I/O. One currently has: _gfortran_transfer_integer_write (&dt_parm.0, &is[0], 4); which requires the whole object though only the first 4 bytes are needed (= &"1"). * The constructor should not be fully expanded, if one only needs a single element, i.e. using integer, parameter:: is(*)=(/(i,i=1,10000000)/) should be quick if one only needs the first element. In any case, no parameter array should be written if one can simplify it at front-end compilation time.
next reply other threads:[~2011-11-21 21:31 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-11-21 22:01 burnus at gcc dot gnu.org [this message] 2014-05-01 12:43 ` [Bug fortran/51260] " dominiq at lps dot ens.fr
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-51260-4@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).