public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28306]  New: const / pure call with ignored argument emitted.
@ 2006-07-07 16:52 amylaar at gcc dot gnu dot org
  2006-07-07 16:54 ` [Bug c/28306] " amylaar at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-07-07 16:52 UTC (permalink / raw)
  To: gcc-bugs

There is code in the expanders which is supposed to avoid emitting calls
to pure functions which have their result ignored, but it doesn't appear to
work when the function called is represented as a COND_EXPR.


-- 
           Summary: const / pure call with ignored argument emitted.
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
OtherBugsDependingO 28289
             nThis:


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


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

* [Bug c/28306] const / pure call with ignored argument emitted.
  2006-07-07 16:52 [Bug c/28306] New: const / pure call with ignored argument emitted amylaar at gcc dot gnu dot org
@ 2006-07-07 16:54 ` amylaar at gcc dot gnu dot org
  2006-07-07 17:30 ` rguenth at gcc dot gnu dot org
  2008-01-13 18:49 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-07-07 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from amylaar at gcc dot gnu dot org  2006-07-07 16:54 -------
Created an attachment (id=11850)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11850&action=view)
test case

The available source code for the functions allows the compiler to
see that the called functions are const.
This should be sufficient for the compiler to figure out the call is not
needed.
Likewise, the pure attributes should also be sufficient to figure this out.


-- 


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


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

* [Bug c/28306] const / pure call with ignored argument emitted.
  2006-07-07 16:52 [Bug c/28306] New: const / pure call with ignored argument emitted amylaar at gcc dot gnu dot org
  2006-07-07 16:54 ` [Bug c/28306] " amylaar at gcc dot gnu dot org
@ 2006-07-07 17:30 ` rguenth at gcc dot gnu dot org
  2008-01-13 18:49 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-07 17:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-07-07 17:30 -------
Confirmed.


-- 

rguenth 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         |2006-07-07 17:30:13
               date|                            |


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


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

* [Bug c/28306] const / pure call with ignored argument emitted.
  2006-07-07 16:52 [Bug c/28306] New: const / pure call with ignored argument emitted amylaar at gcc dot gnu dot org
  2006-07-07 16:54 ` [Bug c/28306] " amylaar at gcc dot gnu dot org
  2006-07-07 17:30 ` rguenth at gcc dot gnu dot org
@ 2008-01-13 18:49 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-13 18:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-01-13 18:22 -------
This works for 'const' functions because they stick on the function type as
well.
The attributes are only on the DECL and do not get merged and transfered to the
resulting function type of the COND_EXPR.

So this again asks for streamlining attributes on types vs. decls.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-01-13 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07 16:52 [Bug c/28306] New: const / pure call with ignored argument emitted amylaar at gcc dot gnu dot org
2006-07-07 16:54 ` [Bug c/28306] " amylaar at gcc dot gnu dot org
2006-07-07 17:30 ` rguenth at gcc dot gnu dot org
2008-01-13 18:49 ` rguenth 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).