public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41682]  New: Need for attributes to tag code blocks so optimiser can remove more code.
@ 2009-10-12 11:26 oiaohm at gmail dot com
  2009-10-12 12:48 ` [Bug middle-end/41682] " rguenth at gcc dot gnu dot org
  2009-10-12 20:04 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: oiaohm at gmail dot com @ 2009-10-12 11:26 UTC (permalink / raw)
  To: gcc-bugs

Ok this is a really poor example bare with me.
FILE * f;
char * c;
f = fopen(file,"r")
c = fgetc(f)
fclose(f);

Let say this is a block of code inside a program c and f are never used
anywhere else.  Currently optimizer has no way to know that I know of that this
code can be junked if if its not used.  Programmer need to be able to place
markers to this effect.   One place were this could see some size reductions is
in crt0.o with processing of command line.  If the output is not used why do
the processing.

I hope I have assigned this to the right part.


-- 
           Summary: Need for attributes to tag code blocks so optimiser can
                    remove more code.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oiaohm at gmail dot com


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


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

* [Bug middle-end/41682] Need for attributes to tag code blocks so optimiser can remove more code.
  2009-10-12 11:26 [Bug middle-end/41682] New: Need for attributes to tag code blocks so optimiser can remove more code oiaohm at gmail dot com
@ 2009-10-12 12:48 ` rguenth at gcc dot gnu dot org
  2009-10-12 20:04 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-10-12 12:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-10-12 12:48 -------
Hm?  This code has side-effects, so it cannot be safely removed by a compiler.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug middle-end/41682] Need for attributes to tag code blocks so optimiser can remove more code.
  2009-10-12 11:26 [Bug middle-end/41682] New: Need for attributes to tag code blocks so optimiser can remove more code oiaohm at gmail dot com
  2009-10-12 12:48 ` [Bug middle-end/41682] " rguenth at gcc dot gnu dot org
@ 2009-10-12 20:04 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-12 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-10-12 20:04 -------
Just to expand on that, fopen might change errno and it also it might return
NULL which case fgetc might cause the program to seg fault.  etc.


-- 


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


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

end of thread, other threads:[~2009-10-12 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12 11:26 [Bug middle-end/41682] New: Need for attributes to tag code blocks so optimiser can remove more code oiaohm at gmail dot com
2009-10-12 12:48 ` [Bug middle-end/41682] " rguenth at gcc dot gnu dot org
2009-10-12 20:04 ` pinskia 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).