[comp.lang.c] Copiling warning, C4058 of MSC V5.1 - DS != SS

h-lee%hogum.utah.edu@cs.utah.edu (LEE Hyo Jong) (02/07/91)

Hi,
sorry for this cross posting, but I didn't get any response from
my original posting.

I got the warning of 'address of frame variable taken, DS!=SS'.
It usually happens when I calls the math lib functions such as
pow() or sin() or when I manipulate three dimensional arrays.
Since I am using multithread, one of my compile options(MSC V5.1) is
-Aluf.  I think it causes the problem but I am not sure how to get lid of
the warnings.

Thanks,
---------------
LEE, Hyo Jong  - OI -
801-581-8377 (office)   801-582-5127 (home)
({ihnp4,decvax}!utah-cs!h-lee, h-lee@cs.utah.edu)

ballard@cheddar.ucs.ubc.ca (Alan Ballard) (02/07/91)

In article <1991Feb6.091030.27891@hellgate.utah.edu> h-lee%hogum.utah.edu@cs.utah.edu (LEE Hyo Jong) writes:
>I got the warning of 'address of frame variable taken, DS!=SS'.
>It usually happens when I calls the math lib functions such as
>pow() or sin() or when I manipulate three dimensional arrays.
>Since I am using multithread, one of my compile options(MSC V5.1) is
>-Aluf.
 
Hm, this should only happen if you're passing a near pointer, which
shouldn't occur with -Aluf.  Is it possible the functions involved
have explicit "near" attributes for parameters etc.?   
 
I have managed to suppress this message in the past, in situations where
SS was == DS, even though the compiler didn't know it, by using casts. 
Don't remember the details: something like a cast to a far pointer then
a cast to a near pointer. 


Alan Ballard                   | Internet: ballard@ucs.ubc.ca
University Computing Services  |   Bitnet: USERAB1@UBCMTSG
University of British Columbia |    Phone: 604-228-3074
Vancouver B.C. Canada V6R 1W5  |      Fax: 604-228-5116

db3l@ibm.com (David Bolen) (02/08/91)

In article <1991Feb6.180813.12005@unixg.ubc.ca> ballard@cheddar.ucs.ubc.ca (Alan Ballard) writes:

>In article <1991Feb6.091030.27891@hellgate.utah.edu> h-lee%hogum.utah.edu@cs.utah.edu (LEE Hyo Jong) writes:
>>I got the warning of 'address of frame variable taken, DS!=SS'.
>>It usually happens when I calls the math lib functions such as
>>pow() or sin() or when I manipulate three dimensional arrays.
>>Since I am using multithread, one of my compile options(MSC V5.1) is
>>-Aluf.
>
>Hm, this should only happen if you're passing a near pointer, which
>shouldn't occur with -Aluf.  Is it possible the functions involved
>have explicit "near" attributes for parameters etc.?   

Unfortunately, one of the bugs in MSC 5.1 (not sure about 6.0, but it's
got enough of its own to worry about), was that when using -Alfu that
particular warning is displayed when it really isn't true.  Apparently
the compiler should print the warning except in cases when -Alfu is being
used, but Microsoft missed a check for those options and displays the
warning anyway.

This generally happens when creating multithread programs, but it can
also happen with basic PM programs (where the window procedures also
need -Alfu since they run with SS != DS).

Unfortunately, this makes this warning difficult to trust.  The best
thing I can suggest is to verify your use of local variables, but for
the most part, if using -Alfu, ignore the warning, since you know you've
told the compiler not to assume SS == DS for your functions.

--
-- David
--
/-----------------------------------------------------------------------\
 \                             David Bolen                             /
  |    Laboratory Automation, IBM Thomas J. Watson Research Center    |
 /              P.O. Box 218, Yorktown Heights, NY  10598              \
| - - - - - - - - - - - -  M i t h r a n d i r  - - - - - - - - - - - - |
| Internet : db3l@ibm.com                    | Bitnet : db3l@yktvmv     |
| Usenet   : uunet!bywater!arnor!larios!db3l | Phone  : (914) 945-1940  |
|   /---------------------------------------------------------------\   |
 \-( All comments/opinions are mine and don't represent those of IBM )-/
    \---------------------------------------------------------------/