Mail Archives: djgpp/1998/07/25/20:01:32
Inquisitor Nikodemus wrote:
>
> Hey!
>
> The problem is returning function result. Let's say,I've a piece of
> asm code in my function,frankly,the asm code is whole function.
> In extended assembly we've got possibility of outputing some values.
> Now,I don't want to declare stupid additional eg. "int result" in my
> function only as a returning buffer for ,let's say, value in eax
> register ( that's the factual result of asm code) - what i want is
> direct return of my asm EAX value.
>
> So, my idea was to declare somthing like that :
>
> int my_function ( parameters...) {
> asm ( "blahblahblah..."
> : /* output */ "=a" (my_function)
> : blah,blah
> : blah,blah); };
> instead of :
>
> int my_function(parameters ..){
> int result ;
> asm (" blah..."
> ; "=a" (result)
> : blah
> : blah ); return result };
>
> and IT WORKED! but only for a one function call, the further execution
> of the program resulted in SIGSEV . How to solve that ?
Your new code was completely meaningless. You can't change the value of
an object of type function. In fact, I consider it a bug that GCC
accepted it. The second version you give is correct, and if you
optimize enough, GCC should eliminate the `result' variable entirely.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -