public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38592]  New: eliminate constant string comparisons
@ 2008-12-21 10:47 tkoenig at gcc dot gnu dot org
  2008-12-21 12:05 ` [Bug fortran/38592] eliminate some " tkoenig at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-12-21 10:47 UTC (permalink / raw)
  To: gcc-bugs

$ cat foo.f90
program main
  character(len=3) :: a
  a = 'yes'
  print *,'yes' == a
end program main
$ gfortran -fdump-tree-optimized -O3 -S foo.f90
$ grep compare_string foo.s
        call    _gfortran_compare_string


-- 
           Summary: eliminate constant string comparisons
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
OtherBugsDependingO 19276,36854
             nThis:


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


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

* [Bug fortran/38592] eliminate some string comparisons
  2008-12-21 10:47 [Bug fortran/38592] New: eliminate constant string comparisons tkoenig at gcc dot gnu dot org
@ 2008-12-21 12:05 ` tkoenig at gcc dot gnu dot org
  2008-12-28  1:32 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-12-21 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2008-12-21 12:03 -------
To clarify, we could detect that the variable only ever
has the value of 'yes'.  We already do the right
thing with constants:

$ cat foo-2.f90
program main
  character(len=3), parameter :: a = 'yes'
  print *,'yes' == a
end program main
$ gfortran -fdump-tree-original foo-2.f90
$ grep compare foo-2.f90.003t.original
$ 


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Priority|P3                          |P5
            Summary|eliminate constant string   |eliminate some string
                   |comparisons                 |comparisons


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


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

* [Bug fortran/38592] eliminate some string comparisons
  2008-12-21 10:47 [Bug fortran/38592] New: eliminate constant string comparisons tkoenig at gcc dot gnu dot org
  2008-12-21 12:05 ` [Bug fortran/38592] eliminate some " tkoenig at gcc dot gnu dot org
@ 2008-12-28  1:32 ` dfranke at gcc dot gnu dot org
  2009-02-19  5:44 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-12-28  1:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2008-12-28 01:28 -------
This is generally the case, not just for/with strings.

I don't think that anything will ever happen in this regard, at least, not on
the frontend side. If (some) intrinsics, including string comparisons, were
inlined, the optimizers could probably do something about it. 


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/38592] eliminate some string comparisons
  2008-12-21 10:47 [Bug fortran/38592] New: eliminate constant string comparisons tkoenig at gcc dot gnu dot org
  2008-12-21 12:05 ` [Bug fortran/38592] eliminate some " tkoenig at gcc dot gnu dot org
  2008-12-28  1:32 ` dfranke at gcc dot gnu dot org
@ 2009-02-19  5:44 ` pault at gcc dot gnu dot org
  2009-05-08  9:31 ` fxcoudert at gcc dot gnu dot org
  2009-05-08 11:25 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-02-19  5:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2009-02-19 05:44 -------
Thomas, As a matter of curiosity, do other compilers catch this?

Confirmed

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-02-19 05:44:12
               date|                            |


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


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

* [Bug fortran/38592] eliminate some string comparisons
  2008-12-21 10:47 [Bug fortran/38592] New: eliminate constant string comparisons tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-02-19  5:44 ` pault at gcc dot gnu dot org
@ 2009-05-08  9:31 ` fxcoudert at gcc dot gnu dot org
  2009-05-08 11:25 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-08  9:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2009-05-08 09:30 -------
(In reply to comment #3)
> As a matter of curiosity, do other compilers catch this?

Intel does not.


-- 


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


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

* [Bug fortran/38592] eliminate some string comparisons
  2008-12-21 10:47 [Bug fortran/38592] New: eliminate constant string comparisons tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-05-08  9:31 ` fxcoudert at gcc dot gnu dot org
@ 2009-05-08 11:25 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-05-08 11:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2009-05-08 11:25 -------
> > As a matter of curiosity, do other compilers catch this?
> Intel does not.

Sure? If I look at the assembler of ifort 11.1 with -O3, I only see:
        call      __intel_new_proc_init                         #1.9
        call      for_set_reentrancy                            #1.9
        call      for_write_seq_lis                             #4.3
And if I'm not mistaken, sunf95 also does not have any call anymore.


-- 


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


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

end of thread, other threads:[~2009-05-08 11:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-21 10:47 [Bug fortran/38592] New: eliminate constant string comparisons tkoenig at gcc dot gnu dot org
2008-12-21 12:05 ` [Bug fortran/38592] eliminate some " tkoenig at gcc dot gnu dot org
2008-12-28  1:32 ` dfranke at gcc dot gnu dot org
2009-02-19  5:44 ` pault at gcc dot gnu dot org
2009-05-08  9:31 ` fxcoudert at gcc dot gnu dot org
2009-05-08 11:25 ` burnus at gcc dot gnu dot 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).