public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/27365]  New: add a way to mark that a path cannot be taken, something like __builtin_unreachable()
@ 2006-04-30 19:24 dann at godzilla dot ics dot uci dot edu
  2006-04-30 19:34 ` [Bug tree-optimization/27365] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-04-30 19:24 UTC (permalink / raw)
  To: gcc-bugs

It would be nice to have some form of a builtin that shows that a portion of
the code is not reachable, and it generates no code in the binary. 

gcc_unreachable() is used now in the gcc sources for this, but it will generate
assembly code that calls abort().

Another way to accomplish the same thing could be with attributes
Can attributes be used for function calls? I beleive right now they can't. 
If they could, then something like this could work:
myfunc(foo,bar,baz) __attribute__((noreturn));
Some functions are known not to return only in certain situations, so they
cannot be declared as being "noreturn". An example where this would be useful
is the Fsignal function in emacs.


-- 
           Summary: add a way to mark that a path cannot be taken, something
                    like __builtin_unreachable()
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu


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


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

* [Bug tree-optimization/27365] add a way to mark that a path cannot be taken, something like __builtin_unreachable()
  2006-04-30 19:24 [Bug tree-optimization/27365] New: add a way to mark that a path cannot be taken, something like __builtin_unreachable() dann at godzilla dot ics dot uci dot edu
@ 2006-04-30 19:34 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 19:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-30 19:34 -------
Actually gcc_unreachable is to make sure that the compiler is constaint.

Really marking a path as unreachable is the same thing as using
__builtin_expect.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-04-30 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-30 19:24 [Bug tree-optimization/27365] New: add a way to mark that a path cannot be taken, something like __builtin_unreachable() dann at godzilla dot ics dot uci dot edu
2006-04-30 19:34 ` [Bug tree-optimization/27365] " 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).