CBFalconer wrote:
Adam Naumowicz wrote:
On Thu, 18 Apr 2002, Ernst-Ludwig Bohnen wrote:
On Wed, 17 Apr 2002, Carel Fellinger wrote:
after porting a few thousand lines I think I spotted the next bug.
take this simple program:
program err; type pword = ^word; word = boolean;
word is predeclared as unsigned 32 bit integer. Should gpc complain already here or warn and accept the redefinition and do the job?
As far as I got the ISO standard correct, the 'pword' definition should only be considered a foreward declaration of 'word' when 'word' is undefined and has a definition later in the same block. So the current behaviour of GPC seems rather consequent to me and I don't understand why all Barland's compilers and FPC process it the other way ;-(
If you don't delay the definition you have a situation where the outer block can invalidate a perfectly correct inner block. In particular, word is not predefined or reserved in ISO7185, and I find no reference to it in ISO10206. Converting a valid program to invalid has to be anathema.
I think that's the most important argument.
Anyway, it turned out to be a plain bug. As Maurice noted, GPC behaves correctly for most identifiers, and only `Word' (and a few more) cause the problem.
The special thing about these identifiers is that there are built-in aliases of them (here: `Cardinal'), and GPC identified them too early. So in fact, pword would be changed if you redeclared Cardinal instead of Word. Of course, that's even "wronger" than the original bug. I've fixed all this now. (carel2*.pas) Thanks to all for the report and analysis.
Frank