------- Additional Comments From lts-rudolph at gmx dot de  2004-12-03 08:39 
-------
I think you are not right :-)

The gcc docs say that it is possible to overwrite the abi with ffixed-reg!

It is also an example given (qsort) which comes from external library. The
examples says that you have to recompile the library with giving the ffixed-reg
option and the resulting lib is compatible with the compiled program which uses
a global register variable.

Here is the original text from 3.4.3 online doc:
<snip>
Defining a global register variable in a certain register reserves that register
entirely for this use, at least within the current compilation. The register
will not be allocated for any other purpose in the functions in the current
compilation. The register will not be saved and restored by these functions.
Stores into this register are never deleted even if they would appear to be
dead, but references may be deleted or moved or simplified.

It is not safe to access the global register variables from signal handlers, or
from more than one thread of control, because the system library routines may
temporarily use the register for other things (unless you recompile them
specially for the task at hand).

It is not safe for one function that uses a global register variable to call
another such function foo by way of a third function lose that was compiled
without knowledge of this variable (i.e. in a different source file in which the
variable wasn't declared). This is because lose might save the register and put
some other value there. For example, you can't expect a global register variable
to be available in the comparison-function that you pass to qsort, since qsort
might have put something else in that register. (If you are prepared to
recompile qsort with the same global register variable, you can solve this 
problem.)

If you want to recompile qsort or other source files which do not actually use
your global register variable, so that they will not use that register for any
other purpose, then it suffices to specify the compiler option -ffixed-reg. You
need not actually add a global register declaration to their source code.
<snap>

Maybe the documentation should changed or the bug should be accepted.
The documentation says that also the ABI behaviour could be overwritten.

Regards,
   Klaus

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


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

Reply via email to