public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14411] New: Request for setjmp/longjmp attributes
@ 2004-03-03 17:22 avn at any dot ru
2004-03-03 17:24 ` [Bug c/14411] " avn at any dot ru
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: avn at any dot ru @ 2004-03-03 17:22 UTC (permalink / raw)
To: gcc-bugs
While working on a project that uses a function with setjmp-like semantics, it
became necessary to supply the optimizer with such information. Otherwise, the
following code:
void *ptr = NULL;
if (mysetjmp()) {
if (ptr) free(ptr);
}
else {
/* ... */
ptr = malloc(...);
/* ... */
}
does not do the call to free() when compiled with -O2 (the optimizer believes
the ptr still is NULL and eliminates the call to free() completely).
--
Summary: Request for setjmp/longjmp attributes
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: avn at any dot ru
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
@ 2004-03-03 17:24 ` avn at any dot ru
2004-03-03 17:25 ` avn at any dot ru
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avn at any dot ru @ 2004-03-03 17:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From avn at any dot ru 2004-03-03 17:24 -------
Created an attachment (id=5855)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5855&action=view)
Patch to resolve this
Attached the patch to allow specification of 'setjmp'/'longjmp' attributes to a
function.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
2004-03-03 17:24 ` [Bug c/14411] " avn at any dot ru
@ 2004-03-03 17:25 ` avn at any dot ru
2004-03-03 17:32 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avn at any dot ru @ 2004-03-03 17:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From avn at any dot ru 2004-03-03 17:25 -------
With the patch applied (against 3.3.3 sources), the example code is compiled
correctly if mysetjmp() is declared with __attribute__((setjmp)).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
2004-03-03 17:24 ` [Bug c/14411] " avn at any dot ru
2004-03-03 17:25 ` avn at any dot ru
@ 2004-03-03 17:32 ` pinskia at gcc dot gnu dot org
2004-03-03 17:46 ` jsm at polyomino dot org dot uk
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-03 17:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-03 17:32 -------
Confirmed, patches goto gcc-patches@gcc.gnu.org with a changelog and a description. Please read
<http://gcc.gnu.org/contribute.html> ____before____ sumbitting them though.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-03-03 17:32:10
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (2 preceding siblings ...)
2004-03-03 17:32 ` pinskia at gcc dot gnu dot org
@ 2004-03-03 17:46 ` jsm at polyomino dot org dot uk
2004-03-03 20:13 ` schwab at suse dot de
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-03-03 17:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm at polyomino dot org dot uk 2004-03-03 17:46 -------
Subject: Re: New: Request for setjmp/longjmp attributes
On Wed, 3 Mar 2004, avn at any dot ru wrote:
> While working on a project that uses a function with setjmp-like semantics, it
> became necessary to supply the optimizer with such information. Otherwise, the
> following code:
Might such an attribute for setjmp be specifiable in a way making it
suitable for vfork as well? special_function_p presently handles both the
same. However, we want to get rid of this ad hoc handling and replace it
with proper attributes. For ISO C functions these should be handled
through built-in functions in builtins.def. (There may be a complication
because __builtin_setjmp does not correspond to the ISO C setjmp function,
and likewith __builtin_longjmp, so this cleanup should probably be
separated from the base patch that adds the attributes with testcases and
documentation.) For non-ISO functions not in the reserved namespaces,
these should be handled through fixincludes: the correct attributes are
needed for correct compilation, so it isn't OK for them to be disabled in
ISO C mode. (Since these functions involve types defined in headers, we
don't need to allow for users declaring them without including the
appropriate headers.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (3 preceding siblings ...)
2004-03-03 17:46 ` jsm at polyomino dot org dot uk
@ 2004-03-03 20:13 ` schwab at suse dot de
2004-06-02 3:49 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: schwab at suse dot de @ 2004-03-03 20:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2004-03-03 20:13 -------
Even with setjmp you must declare such a variable as volatile to get correct
behaviour.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (4 preceding siblings ...)
2004-03-03 20:13 ` schwab at suse dot de
@ 2004-06-02 3:49 ` pinskia at gcc dot gnu dot org
2004-06-02 6:41 ` avn at any dot ru
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-02 3:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-02 03:49 -------
What we need is an attribute that says may return twice.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Last reconfirmed|2004-03-03 17:32:10 |2004-06-02 03:49:16
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (5 preceding siblings ...)
2004-06-02 3:49 ` pinskia at gcc dot gnu dot org
@ 2004-06-02 6:41 ` avn at any dot ru
2004-11-30 7:47 ` zack at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: avn at any dot ru @ 2004-06-02 6:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From avn at any dot ru 2004-06-02 06:41 -------
Should I update the patch, renaming this attribute to somewhat like
"__attribute__((double_return))"? And what should 'longjmp' be renamed to, then?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (6 preceding siblings ...)
2004-06-02 6:41 ` avn at any dot ru
@ 2004-11-30 7:47 ` zack at gcc dot gnu dot org
2005-03-08 13:20 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: zack at gcc dot gnu dot org @ 2004-11-30 7:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From zack at gcc dot gnu dot org 2004-11-30 07:47 -------
+kw, milestone; assigning to myself for commitment once 4.1 opens.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |zack at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Keywords| |patch
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (7 preceding siblings ...)
2004-11-30 7:47 ` zack at gcc dot gnu dot org
@ 2005-03-08 13:20 ` cvs-commit at gcc dot gnu dot org
2005-03-08 14:37 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-08 13:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-03-08 13:19 -------
Subject: Bug 14411
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rth@gcc.gnu.org 2005-03-08 13:19:41
Modified files:
gcc : ChangeLog c-common.c calls.c tree.h
gcc/doc : extend.texi
Added files:
gcc/testsuite/gcc.dg: attr-returns_twice-1.c
Log message:
PR c/14411
* calls.c (flags_from_decl_or_type): Handle eturns_twice' attribute.
* c-common.c (handle_returns_twice): New function.
(c_common_attribute_table): Declare eturns_twice' attribute.
* doc/extend.texi: Document eturns_twice' attribute.
* tree.h (DECL_IS_RETURNS_TWICE): New macro.
(struct tree_decl): Add returns_twice_flag.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7728&r2=2.7729
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.606&r2=1.607
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/calls.c.diff?cvsroot=gcc&r1=1.380&r2=1.381
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.698&r2=1.699
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.242&r2=1.243
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/attr-returns_twice-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (8 preceding siblings ...)
2005-03-08 13:20 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-08 14:37 ` pinskia at gcc dot gnu dot org
2005-03-08 14:38 ` pinskia at gcc dot gnu dot org
2005-03-08 19:02 ` avn at any dot ru
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-08 14:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-08 14:36 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (9 preceding siblings ...)
2005-03-08 14:37 ` pinskia at gcc dot gnu dot org
@ 2005-03-08 14:38 ` pinskia at gcc dot gnu dot org
2005-03-08 19:02 ` avn at any dot ru
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-08 14:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-08 14:38 -------
Actually I take that back, it is only 1 out of 3 which was applied.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/14411] Request for setjmp/longjmp attributes
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
` (10 preceding siblings ...)
2005-03-08 14:38 ` pinskia at gcc dot gnu dot org
@ 2005-03-08 19:02 ` avn at any dot ru
11 siblings, 0 replies; 13+ messages in thread
From: avn at any dot ru @ 2005-03-08 19:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From avn at any dot ru 2005-03-08 19:02 -------
Actually, it is fixed. The other two patches that I pinged are not related to
this PR.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14411
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-03-08 19:02 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-03 17:22 [Bug c/14411] New: Request for setjmp/longjmp attributes avn at any dot ru
2004-03-03 17:24 ` [Bug c/14411] " avn at any dot ru
2004-03-03 17:25 ` avn at any dot ru
2004-03-03 17:32 ` pinskia at gcc dot gnu dot org
2004-03-03 17:46 ` jsm at polyomino dot org dot uk
2004-03-03 20:13 ` schwab at suse dot de
2004-06-02 3:49 ` pinskia at gcc dot gnu dot org
2004-06-02 6:41 ` avn at any dot ru
2004-11-30 7:47 ` zack at gcc dot gnu dot org
2005-03-08 13:20 ` cvs-commit at gcc dot gnu dot org
2005-03-08 14:37 ` pinskia at gcc dot gnu dot org
2005-03-08 14:38 ` pinskia at gcc dot gnu dot org
2005-03-08 19:02 ` avn at any dot ru
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).