public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51260] New: PARAMETER array with constructor initializer: Compile-time simplify single element access
@ 2011-11-21 22:01 burnus at gcc dot gnu.org
  2014-05-01 12:43 ` [Bug fortran/51260] " dominiq at lps dot ens.fr
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-21 22:01 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/51260] PARAMETER array with constructor initializer: Compile-time simplify single element access
  2011-11-21 22:01 [Bug fortran/51260] New: PARAMETER array with constructor initializer: Compile-time simplify single element access burnus at gcc dot gnu.org
@ 2014-05-01 12:43 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-05-01 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-01
                 CC|                            |tkoenig at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r209975.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-01 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-21 22:01 [Bug fortran/51260] New: PARAMETER array with constructor initializer: Compile-time simplify single element access burnus at gcc dot gnu.org
2014-05-01 12:43 ` [Bug fortran/51260] " dominiq at lps dot ens.fr

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).