BUG: Compiler Omits C4758 and/or C4762 WarningsLast reviewed: July 22, 1997Article ID: Q115326 |
7.00 | 1.00 1.50
MS-DOS | WINDOWS
kbtool kbbuglist
The information in this article applies to:
SYMPTOMSWhen you pass the address of a local variable as an argument in a function call and use the /Aw compiler switch, the C/C++ compiler generates different warnings, depending on whether the optimizing compiler is used. There should be warnings generated, but they should be the same each time. Under C/C++, version 7.0, if the optimizing compiler is used (compile with /f-), the following warning is generated for a .C file:
test.c(8) : warning C4762: near/far mismatch in argument : conversion suppliedIf the fast compiler option is used (/f), a different warning is generated:
test.c(8) : warning C4758: address of automatic (local) variable taken, DS != SSUnder the C/C++ compiler, versions 8.0 and 8.0c, if the optimizing compiler is used, only the C4762 warning is generated. If the fast compiler is used, both the C4758 and C4762 warnings are generated. However, if a .CPP or a .CXX file is used, no warnings are generated when using the /f- option.
RESOLUTIONMicrosoft has confirmed this to be a bug in the products listed above. We are researching this problem and will post new information in the Microsoft Knowledge Base as soon as it becomes available.
MORE INFORMATIONThe following sample can be used to demonstrate the problem. If the file is named TEST.C, warning C4762 is produced. If the file is named TEST.CPP, no warnings are produced.
Sample Code
/* Compile options needed: /ASw /c /f- */ void func( char * ); void test( void ){ char sz[32]; func( sz );}
|
Additional reference words: 1.00 1.50 7.00 8.00 8.00c
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |