This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/48543] New: Collapse identical strings


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]