public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/48543] New: Collapse identical strings @ 2011-04-10 18:31 tkoenig at gcc dot gnu.org 2011-04-11 10:05 ` [Bug fortran/48543] " jb at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: tkoenig at gcc dot gnu.org @ 2011-04-10 18:31 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48543 Summary: Collapse identical strings Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: tkoenig@gcc.gnu.org The two programs yield identical results. The second program results in a shorter object file because the ig25@linux-fd1f:~/Krempel/String> cat foo.f90 program main character(len=17) :: a character(len=34) :: b a = 'Supercalifragilis' b = 'Supercalifragilisticexpialidocious' print *,a," ",b end program main ig25@linux-fd1f:~/Krempel/String> cat bar.f90 program main character(len=17) :: a character(len=34) :: b a = 'Supercalifragilisticexpialidocious' b = 'Supercalifragilisticexpialidocious' print *,a," ",b end program main ig25@linux-fd1f:~/Krempel/String> gfortran -c -Os foo.f90 ig25@linux-fd1f:~/Krempel/String> gfortran -c -Os bar.f90 ig25@linux-fd1f:~/Krempel/String> ls -l foo.f90 bar.f90 -rw-r--r-- 1 ig25 users 184 10. Apr 19:02 bar.f90 -rw-r--r-- 1 ig25 users 167 10. Apr 19:01 foo.f90 g25@linux-fd1f:~/Krempel/String> strings foo.o | grep Super SupercalifragilisSupercalifragilisticexpialidocious ig25@linux-fd1f:~/Krempel/String> strings bar.o | grep Super Supercalifragilisticexpialidocious This is an optimization that could be done for -Os, at least. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/48543] Collapse identical strings 2011-04-10 18:31 [Bug fortran/48543] New: Collapse identical strings tkoenig at gcc dot gnu.org @ 2011-04-11 10:05 ` jb at gcc dot gnu.org 2011-11-08 7:44 ` fxcoudert at gcc dot gnu.org 2012-06-07 14:59 ` tkoenig at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: jb at gcc dot gnu.org @ 2011-04-11 10:05 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48543 Janne Blomqvist <jb at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jb at gcc dot gnu.org --- Comment #1 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-04-11 10:04:50 UTC --- For string constants, I agree, though I doubt whether it's worth the bother. For string variables, I think this would be a mistake. Review the long and sordid history of COW implementations of the C++ std::string type for arguments why. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/48543] Collapse identical strings 2011-04-10 18:31 [Bug fortran/48543] New: Collapse identical strings tkoenig at gcc dot gnu.org 2011-04-11 10:05 ` [Bug fortran/48543] " jb at gcc dot gnu.org @ 2011-11-08 7:44 ` fxcoudert at gcc dot gnu.org 2012-06-07 14:59 ` tkoenig at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: fxcoudert at gcc dot gnu.org @ 2011-11-08 7:44 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48543 Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011-11-08 CC| |fxcoudert at gcc dot | |gnu.org Ever Confirmed|0 |1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/48543] Collapse identical strings 2011-04-10 18:31 [Bug fortran/48543] New: Collapse identical strings tkoenig at gcc dot gnu.org 2011-04-11 10:05 ` [Bug fortran/48543] " jb at gcc dot gnu.org 2011-11-08 7:44 ` fxcoudert at gcc dot gnu.org @ 2012-06-07 14:59 ` tkoenig at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: tkoenig at gcc dot gnu.org @ 2012-06-07 14:59 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48543 --- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-06-07 14:58:38 UTC --- I'll do a bit of work on that, because it can also be useful for reducing memcpy/memset pairs. Consider character(len=3) :: a character(len=4) :: b a = 'a' b = 'a' This could be changed into (in a first pass) a = 'a ' b = 'a ' for a simple assignment, but this would mean duplicate strings. Better to change this into a = 'a ' b = 'a ' ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-07 14:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-04-10 18:31 [Bug fortran/48543] New: Collapse identical strings tkoenig at gcc dot gnu.org 2011-04-11 10:05 ` [Bug fortran/48543] " jb at gcc dot gnu.org 2011-11-08 7:44 ` fxcoudert at gcc dot gnu.org 2012-06-07 14:59 ` tkoenig at gcc dot gnu.org
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).