[comp.sys.amiga] Bug in PDC on Fish disk #110 Thanx again, Fred!

U613042@HNYKUN11.BITNET (Olaf Seibert) (12/08/87)

[ line ]

There is a bug in the Public Domain C Compiler. It demonstrates itself
in one of the example programs, 'logic.c'.

The problem seems to be, that the 'default' case of a switch doesn't
get optimized, even if you want optimization (which is default).
So, when an automatic variable is reassigned to a register in your
function, it isn't in the 'default' case in a switch statement. If you
use this variable there, the original stack location gets used, which
of course is incorrect.
Turn of optimization (option -n) and there is no problem.

I have printed out the entire compiler today, so I am going to look into
it, if time permits, but I am sure the author of it is more likely to
find the problem than I am, due to better familiarity with the code.

Apart from this, I really like the compiler. It generates pretty good
code for the example programs. It even puts the address of printf()
in a register if you call it often enough!

---
The opinions possibly reflected herein are my own, and not necessarily
those of someone else I might be connected with. They MAY, however, be.
>>> I *thought* I was living in a free, modern country....
--- Olaf (Rhialto) Seibert...  U613042@HNYKUN11.BITNET
  USEnet is *almost* an anagram of unsent ... BITnet: Because It's There
          Computers? Just say *YES*!  Customs? Just say *NO*!