> Of course it shouldn't happen. But there are lots of reasons it can > happen, and a bug in the compiler is only one of them. The original > poster did not claim the above code actually fails. Here is the document I kept when I debugged the software. From the revision history and test results, one can decide if there is a bug in the compiler 8.00PL3. Background: version 25 code is a released code originally compiled by 7.87PL4. After upgrading to 8.00PL3 we needed to make modifications to the product. I compiled the modified code with 8.00PL3 and it didn't work. After a few days of frustrations I suspected compiler problem and decided to test it with the original code 25. Version 25 didn't work when compiled by 8.00PL3. Then I wrote a series of debugging version 25T{x} to test. Here are the document. I copied part of the report here and reformatted it for readability. ================ Code Version: 25 Compiler 7.87PL4: Tests passed Compiler 8.00PL3: Tests failed Code Version: 25T6 (This is a stripped down version of 25, only a few functions and simple features left.) Compiler 7.87PL4: Tests passed Compiler 8.00PL3: Tests failed Code Version: 25T8 Changes made from 25T6: All local variables moved out from functions; function parameters kept intact Compiler 8.00PL3: Some tests passed; some failed Code Version: 25T9 Changes made from 25T6: All local variables moved out from functions; function parameters removed (passed by global variables) Compiler 8.00PL3: Tests passed Code Version: 25T10 Changes made from 25T6: All local variables defined as "static"; function parameters removed (passed by global variables) Compiler 8.00PL3: Tests passed ================ To me it's a bug. Tony ----- Original Message ----- From: "John Temples" To: Sent: Tuesday, August 12, 2003 10:05 PM Subject: Re: [PIC]: Seek C Complier Recommendations > On Wed, 13 Aug 2003, john chung wrote: > > > > unsigned char foo1() > > > { > > > unsigned char i; > > > i = 1; > > > foo2(); > > > return i; // should return 1 > > > } > > > > > > void foo2() > > > { > > > unsigned char i; > > > // code here... > > > i = 2; > > > // code here... > > > } > > > Based on the ANSI C this shouldn't happen. Of course, the compiler writers could > > not follow ANSI C....... Not sure about that last statement. > > Of course it shouldn't happen. But there are lots of reasons it can > happen, and a bug in the compiler is only one of them. The original > poster did not claim the above code actually fails. > > -- > John W. Temples, III > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body