www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/21/19:13:58

Date: Fri, 21 Apr 95 14:49:48 PDT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: baca AT crl DOT ucsd DOT edu (Kevin Baca)

>Hi:
>I had a bit of a headscratcher that I though was worth mentioning.
>The inline functions in <sys/farptr.h> only work with optimization on, 
>right?  Well, optimization can also mangle them severely!

I've had several problems with inline functions that contain inline
assembly.  As far as I know, I'm doing everything correctly (informing
the compiler of which registers I'm using, etc.) but sometimes, when
the parameters to the inline functions involve multiple levels of
pointer indirection (i.e. structure pointers inside of a structure), the
registers get trashed between calls to the inline functions.

For example, if my inline function is called Func and I call it like this...

        s1->s11.i = Func(s1->s12.j);
        s2->s21.i = Func(s2->s32.j);
        s3->s31.i = Func(s3->s32.j);

by the time I get to the third statement, I get errors (Segmentation
Violation, Division by Zero, etc.)  When I step through the assembly
in my debugger, the registers are not getting preserved across calls.

Any Ideas?  Should this be reported to the FSF?

-Kevin
baca AT crl DOT ucsd DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019