This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Outdated recommendation?
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Chris Lattner <sabre at nondot dot org>
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 06 Jul 2004 11:19:55 -0700
- Subject: Re: Outdated recommendation?
- References: <Pine.LNX.4.44.0406172151050.1203-100000@nondot.org>
Chris Lattner wrote:
Is this obsolete?
"If you want a variable to be unaltered by longjmp, and you don't want to
write volatile because old C compilers don't accept it, just take the
address of the variable.
Yes. We shouldn't be worrying about K&R C compilers that don't accept
volatile anymore. Also, we shouldn't be trying to explain how to force
a variable onto the stack by taking its address, particularly since this
is getting harder with tree-ssa and unit-at-time, and will get even
harder with IMA.
I added the following patch to remove the obsolete recommendation.
This was tested with an x86-linux make info.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
2004-07-06 James E Wilson <wilson@specifixinc.com>
* doc/interface.texi (longjmp and automatic variables): Delete
paragraph recommending taking the address of a variable.
Index: interface.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/interface.texi,v
retrieving revision 1.5
diff -p -r1.5 interface.texi
*** interface.texi 4 Feb 2004 05:33:12 -0000 1.5
--- interface.texi 6 Jul 2004 17:58:36 -0000
*************** values after a @code{longjmp}. And this
*** 69,85 ****
because it is very difficult to restore register variables correctly, and
one of GCC's features is that it can put variables in registers without
your asking it to.
-
- If you want a variable to be unaltered by @code{longjmp}, and you don't
- want to write @code{volatile} because old C compilers don't accept it,
- just take the address of the variable. If a variable's address is ever
- taken, even if just to compute it and ignore it, then the variable cannot
- go in a register:
-
- @smallexample
- @{
- int careful;
- &careful;
- @dots{}
- @}
- @end smallexample
--- 69,71 ----