View Issue Details

IDProjectCategoryView StatusLast Update
00003941003.1(2008)/Issue 7System Interfacespublic2013-04-16 13:06
Reporternick Assigned Toajosey  
PrioritynormalSeverityCommentTypeClarification Requested
Status ClosedResolutionAccepted 
NameNick Stoughton
OrganizationUSENIX
User Referencenms-longjmp-01
Sectionlongjmp
Page Number1256
Line Number41363-41364
Interp StatusApproved
Final Accepted TextSee 0000394:0000793
Summary0000394: longjmp clarification
DescriptionThe C committee noticed the following problem when I presented the POSIX words to them:
The text currently states:

The longjmp() function shall restore the environment saved by the most recent invocation of setjmp() in the same thread, with the corresponding jmp_buf argument.

This implies that if thread A calls setjmp(j), and then sometime later, thread B calls setjmp(j) [i.e. with the
same jmp_buf] that the implementation has to track the jump_buf as a thread local variable ... and if thread A subsequently (i.e. after thread B has changed the jmp_buf) calls longjmp(j,x), then it will jump to the first setjmp location (i.e. the one in thread A).

Desired ActionReplace

The longjmp() function shall restore the environment saved by the most recent invocation of setjmp() in the same thread, with the corresponding jmp_buf argument. If there is no such invocation, or if the function containing the invocation of setjmp() has terminated execution in the interim, or if the invocation of setjmp() was within the scope of an identifier with variably modified type and execution has left that scope in the interim, the behavior is undefined

with

The longjmp() function shall restore the environment saved by the most recent invocation of setjmp() in the same process, with the corresponding jmp_buf argument. If the most recent invocation of setjmp() with the corresponding jmp_buf occurred in another thread, or if there is no such invocation, or if the function containing the invocation of setjmp() has terminated execution in the interim, or if the invocation of setjmp() was within the scope of an identifier with variably modified type and execution has left that scope in the interim, the behavior is undefined
Tagstc1-2008

Activities

Don Cragun

2011-05-26 15:17

manager   bugnote:0000793

Interpretation response
------------------------
The standard states that implementations must perform as stated even though no known implementation is able to do so, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
-------------
The latest C1x draft has adopted wording equivalent to the proposed change.

The changes suggested document existing practice and are, therefore, suitable for a TC.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Make the changes listed in the Desired Action.

ajosey

2011-06-16 10:15

manager   bugnote:0000841

Interpretation proposed 16 June 2011 for final 30 day review

ajosey

2011-06-20 14:14

manager   bugnote:0000864

Corrected the page number.

ajosey

2011-07-29 06:15

manager   bugnote:0000911

The interpretation is now approved.

Issue History

Date Modified Username Field Change
2011-03-16 16:12 nick New Issue
2011-03-16 16:12 nick Status New => Under Review
2011-03-16 16:12 nick Assigned To => ajosey
2011-03-16 16:12 nick Name => Nick Stoughton
2011-03-16 16:12 nick Organization => USENIX
2011-03-16 16:12 nick User Reference => nms-longjmp-01
2011-03-16 16:12 nick Section => longjmp
2011-03-16 16:12 nick Page Number => 1302
2011-03-16 16:12 nick Line Number => 41363-41364
2011-03-16 16:12 nick Interp Status => ---
2011-05-26 15:17 Don Cragun Interp Status --- => Pending
2011-05-26 15:17 Don Cragun Note Added: 0000793
2011-05-26 15:17 Don Cragun Status Under Review => Interpretation Required
2011-05-26 15:17 Don Cragun Resolution Open => Accepted
2011-05-26 15:18 Don Cragun Final Accepted Text => See 0000394:0000793
2011-05-26 15:18 Don Cragun Tag Attached: tc1-2008
2011-06-16 10:15 ajosey Interp Status Pending => Proposed
2011-06-16 10:15 ajosey Note Added: 0000841
2011-06-20 14:14 ajosey Page Number 1302 => 1256
2011-06-20 14:14 ajosey Note Added: 0000864
2011-07-29 06:15 ajosey Interp Status Proposed => Approved
2011-07-29 06:15 ajosey Note Added: 0000911
2013-04-16 13:06 ajosey Status Interpretation Required => Closed