Prof A Olowofoyeku (The African Chief) wrote:
On 27 May 2004 at 1:58, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
Under Mingw, some programs compile without problem, using gp. With others I get this error:
"gp example1 d:\mingw\lib\gcc-lib\mingw32\3.2.3\units\dosunix.pas:400:5: internal erro r: parser position mismatch"
I can't reproduce it. Do you have an example where it occurs? Is it CR/LF related?
So far, it seems to only happen in dosunix.pas (at the very end).
The error always appears at the end. It's an internal consistency check done after reading a file.
It may be CR/LF related, because when I converted the line endings of dosunix.pas from unix to dos format, the error disappeared. But then when I converted it back to unix format again, the problem did not come back!
Can you add the line:
fprintf (stderr, "BufPos: %i, BufCount: %i\n", BufPos, BufCount);
before:
if (BufPos != BufCount) ParseError ("internal error: parser position mismatch");
in gp-parse.c and note the output when running?
This is the output: "d:\mingw\lib\gcc-lib\mingw32\3.2.3\units\dosunix.pas:400:5: internal error: parser position mismatch BufPos: 9871, BufCount: 9870 d:\mingw\lib\gcc-lib\mingw32\3.2.3\units\dosunix.pas:400:5: internal erro r: parser position mismatch BufPos: 9871, BufCount: 9870"
Seems that something is trying to read past EOF (or perhaps an extra character (^z ?) exists in the file).
Still can't reproduce it. Can you send me the output of `gpc -E dosunix.pas'? Can you try to find out which part of the unit is causing problems by removing lines (doesn't have to compile, just `{$if}' etc. have to match)?
Msys throws up some complaints ("gpc -print-file-name=units installation problem: cannot get default unit path"), but seems to be okay in the end, in the sense that the compiled program is there, and runs okay. I have attached a tarball containing logs of the output of the three Win32 platforms. I have ascertained that the complaints by the MSYS binary arise because "DirectoryExists (Res)" returns False when it should return true (in "GetUnitPath"). I have been unable to locate the actual body of the DirectoryExists function to ascertain why this is happening.
It's in the RTS. You reported a problem with it on 2003-11-22 (`Cygwin and "Stat"'), but according to the thread it was related to mingw and/or gcc versions. Anyway it's hard for me to debug. So if you have any suggestions (for a generic fix in the RTS), let me know.
Where in the RTS is DirectoryExists?
filename.pas
Do I have to look for Stat or something to that effect?
Probably (since that's where DirectoryExists calls). It's in rts.c (`_p_Stat').
Frank