home *** CD-ROM | disk | FTP | other *** search
File List | 1992-12-11 | 8.1 KB | 298 lines |
- ----------------------------------------------------------------------
- 1. Expression var = value >= 0.0 ? 1.0 : -1.0; Does Not Work
-
- The follwing program illustrates the problem:
-
- /* Compiler options needed: -Od
- */
-
- #include <stdio.h>
- main()
- {
- double value = 30720.0 ;
- double sign, sign2 ;
-
- // Should work, but doesn't; used to work in July Release
- sign = value >= 0.0 ? 1.0 : -1.0;
-
- // workaround
- if (value >= 0.0)
- sign2 = 1.0;
- else
- sign2 = -1.0;
-
- // results: Sign : 2.122e-313 ; Sign2 : 1
- printf("Sign : %g ; Sign2 ; %g \n", sign, sign2);
- }
-
- ----------------------------------------------------------------------
- 2. Error C2468: 'new' : 'const'/'volatile' Generated
-
- Regression from the July release. ARM 5.3.3 states that
- type-specifier-list may not contain const, volatile, class
- declarations or enum declarations.
-
- /* Compile options needed: none
- */
-
- void foo (void)
- {
- const int **ppi;
- ppi = new const int *[10];
- }
-
- ----------------------------------------------------------------------
- 3. -Zg Gives Internal Compiler Error With __stdcall
-
- /* Compile options needed: -Zg
- */
-
- int __stdcall foo (char *, ...);
-
- ----------------------------------------------------------------------
- 4. Code Generation Problem
-
- The asm code is wrong. It looks like the compiler noticed
- that all it had to do was compare ah to 9, but the asm code is
- cmp eax to 9.
-
- /* Compile options needed: -Fa
- */
-
- main () {
- unsigned num;
- unsigned x;
-
- num = 1388;
-
- if (((unsigned char) ((num & 0x00000F00) >> 8)) > 9)
- x = num;
- else
- x = num + 1;
- }
-
- ; assembly code generated
-
- _main PROC NEAR ; Line 2
- push ebp
- mov ebp, esp
- sub esp, 8
- push ebx
- push esi
- push edi ; Line 7
- mov DWORD PTR _num$[ebp], 1388 ; 0000056cH ; Line 9
- mov eax, DWORD PTR _num$[ebp]
- and eax, 3840 ; 00000f00H
- cmp eax, 9
- jle $L109 ; Line 10
- mov eax, DWORD PTR _num$[ebp]
- mov DWORD PTR _x$[ebp], eax ; Line 11
- jmp $L110 $L109: ; Line 12
- mov eax, DWORD PTR _num$[ebp]
- inc eax
- mov DWORD PTR _x$[ebp], eax $L110: ; Line 14 $L106:
- pop edi
- pop esi
- pop ebx
- leave
- ret 0
- _main ENDP _TEXT ENDS END
-
- ----------------------------------------------------------------------
- 5. Code Generation Problem For Default Arguments in C++
-
- The wrong parameter is used to fill in default argments in C++.
-
- ----------------------------------------------------------------------
- 6. Incorrect Syntax Errors Initializing Static Object
-
- This is a regression from the July release.
-
- ----------------------------------------------------------------------
- 7. -Od -Zi Cause Assert in P2 emit.c db_name (name==NULL)
-
- /* Compile options needed: -Od -Zi
- */
-
- static union {char *bptr; long *lptr; short *sptr;};
- char * func()
- {
- return bptr;
- }
-
- ----------------------------------------------------------------------
- 8. Allocation Size of enum Must be 4, Not 2 in C++
-
- The output of this program is:
-
- Size of Message type: [4]
- Size of Message Descriptor: [44]
-
- The size of operator of enum returns 4 while the allocator of the
- table is using 2. The size of operator of the structure is using
- 44 while the actual size is 40.
-
- /* Compiler options needed: -Od
- */
-
- #include <stdio.h>
- #include <malloc.h>
-
- #define ERROR 1
- #define STANDARD 2
-
- typedef unsigned char U8; /* byte */
- typedef unsigned char u8; /* byte */
- typedef u8 BOOLEAN;
-
- enum MESSAGE_TYPE {
- FIRST_MESSAGE_TYPE = 0,
- INFO = 0,
- WARNING = 1,
- ERROR = 2,
- FATAL = 3,
- N_MESSAGE_TYPES = 4
- };
-
- enum MESSAGE_CATEGORY {
- FIRST_MESSAGE_CATEGORY = 0,
- STANDARD = 0,
- PERFORMANCE = 1,
- SOURCE_ANALYSIS = 2,
- SYNCHRONIZATION = 3,
- VERBOSE = 4,
- TEXT_FRAGMENT = 5,
- N_MESSAGE_CATEGORIES = 6
- };
-
- struct Message_descriptor {
- char* tag;
- enum MESSAGE_TYPE type;
- enum MESSAGE_CATEGORY category;
- int n_printed;
- int n_suppressed;
- BOOLEAN enabled_sw;
- BOOLEAN default_enabled_sw;
- BOOLEAN pass_2_enable;
- U8 audit_flag;
- int suppression_threshold;
- int message_id;
- int arg_count;
- BOOLEAN no_prefix;
- BOOLEAN include_in_message_summary;
- char* text;
- };
-
- struct Message_descriptor msg_desc [] = {
- #if 0
- { "ISDVECTOR", ERROR, STANDARD, 0,0,1,1,0,3,10, 0, 1, 0, 1,
- "Message 1" },
- { "ISDBASED", ERROR, STANDARD, 0,0,1,1,0,3,10, 0, 1, 0, 1,
- "Message 2" },
- { "ISDPROTECT", ERROR, STANDARD, 0,0,1,1,0,3,10, 0, 1, 0, 1,
- "Message 3" },
- #endif
-
- { "ISDCONFLICT", ERROR, STANDARD, 0,0,1,1,0,1,10, 0, 1, 0, 1,
- "Message 4"}
- };
-
- int main (int argc, char* argv[])
- {
- printf("Size of Message type: [%i]\n",
- sizeof(enum MESSAGE_TYPE));
-
- printf ("Size of Message Descriptor: [%i]\n",
- sizeof(struct Message_descriptor));
- return 0;
- }
-
- ----------------------------------------------------------------------
- 9. Incorrect Floating Point Results
-
- In the program output, the values of g and h are zero. This code
- worked in the July release.
-
- /* Compiler options needed: none
- */
-
- #include <stdio.h>
-
- main( int argc, char *argv[] )
- {
- int flag = 1;
- double g = (flag ? 1.0 : 2.0);
- double h = (flag ? 2.0 : 1.0);
-
- printf( "flag %d, g %f, h %f\n", flag, g, h );
-
- return 0;
- }
-
- ----------------------------------------------------------------------
- 10. C4018: '==' signed/unsigned mismatch Generated Incorrectly
-
- This is a regression from the July release.
-
- ----------------------------------------------------------------------
- 11. MFC Apps Fail to Link Due To Unresolved Externals
-
- The fix was to make static member functions assume the ambient
- calling convention.
-
- ----------------------------------------------------------------------
- 12. Incorrect Syntax Error For Function-style Cast
-
- The errors generated are:
-
- error C2144: syntax error : missing ')' before type 'Id'
- error C2512: 'Other' : no appropriate default constructor
- available
-
- This is a regression from the July release
-
- /* Compiler options needed: none
- */
-
- class Id {
- public:
- Id(int) {}
- };
-
- class Other {
- public:
- Other(Id);
- };
-
- void func(int xx) {
- Other *off;
- Other ot(Id(1)); // Compiles
- Other ot2((Id)1); // Compiles
- Other ot3(Id(xx)); // Compiles
- Other ot4((Id)xx); // Compiles
- off=new Other((Id)xx); // Compiles
- off=new Other(Id(xx)); // Syntax error
- }
-
- ----------------------------------------------------------------------
- 13. Incorrect C2177, C4056 and Floating-point Values
-
- When these errors occur, sometimes values in the array are
- initialized correctly and other times they are completely wrong.
- With the same test values, the results are consistent from
- compile to compile, however when other numbers (in range) are
- specified, the values are incorrect. When the values are wrong,
- they usually turn into 1.61667e-308.
-
- error C2177: constant too big
- warning C4056: overflow in float-point constant arithmetic
-
- This is a regression from the July release.
-
- ----------------------------------------------------------------------
- 14. Initialization of Static Array Loops Indefinitely
-
- The algorithm for initialization was n-cubed. This was fixed.
-
- ----------------------------------------------------------------------
-