From: Jeff Sullivan <jps@zk3.dec.com>
Subject: Re: 4.0D/4.0E DEC C optimization bug
Date: 1999/04/13 [thread overview]
Message-ID: <3713880D.ECF3B246@zk3.dec.com> (raw)
In-Reply-To: 5tXNlnALx$2QR$1@joerch.org
The following answer comes from one of our ANSI experts.
<quote>
My take on this is that it's a bug in that the compiler does not know
that sigsetjmp behaves like setjmp. The Single UNIX Spec has the same
words about sigsetjmp and the values of non-volatile locals as the C89
and C9X specs have for setjmp and non-volatile locals. If this
example is coded with setjmp/longjmp instead of the sig-prefixed
versions, then we generate different code that prevents the lifetime
splitting.
I believe the reason we get the right answer for setjmp is that the
compiler always recognizes it as an intrinsic and does the following:
1. We mark the tuple representing the call to setjmp as having abnormal
control flow.
2. We store the result of the call in a temp.
2a. We do some exotic stuff I don't understand to deal with the
possibility of structured exception handling.
3. We generate a volatile label, noting that the label can be reached
by a non-local goto.
4. We generate a fetch of the temp used to hold the result of the
setjmp call.
The user's code doesn't work as expected using sigsetjmp because we
don't recognize it as an intrinsic and do all this fancy stuff.
Workarounds would be to use setjmp instead of sigsetjmp, make the
variables volatile, or compile -O0 (split lifetime analysis is
documented as coming on at -O1).
To fix the bug, the compiler would have to recognize sigsetjmp as well
as setjmp and treat it similarly, which may be harder than it sounds
since sigsetjmp has a different signature (two parameters instead of
one), and the hairy code that deals with setjmp appears to have the
routine's signature (and name?) sort of "wired in". Since sigsetjmp
is not in the C standard, but is declared in <setjmp.h>, I think the
mechanism for making it intrinsic would require an explicit
#pragma intrinsic(sigsetjmp)
</quote>
We will look into resolving the above mentioned problem with
sigsetjmp in future versions of Compaq C.
Let us know if this helps.
Thanks,
-Jeff
--
Jeff Sullivan | Compaq Computer Corp | mailto:jps@zk3.dec.com
DEC C and C++ | Nashua, NH ZK3-2/X29 | Jeff.Sullivan@compaq.com
next prev parent reply other threads:[~1999-04-13 4:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-10 4:00 4.0D/4.0E DEC C optimization bug Joerg Czeranski
1999-04-12 4:00 ` Bernhard Reiter
1999-04-13 4:00 ` Jeff Sullivan
1999-04-13 4:00 ` Jeff Sullivan [this message]
1999-04-15 4:00 ` Joerg Czeranski
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox