Now we are in trouble: I cannot reproduce this bug, neither on DJGPP, nor on Linux.
AARRRGGHHH! All procedures are defined in a unit! Whats worse, some test programs refuse to compile - but only sometimes!! As I said in the original mail, the problem is not CString or Function related - problems also occur with procedures.
Im using the latest beta GPC for DJGPP 2.01. The following tests were compiled from a DOS shell under Windows 3.11, but they also occur when running in pure DOS using CWSDPMI r3.
Below is the ACTUAL (no lie) screen shot of what just happened to me! [Including the habitual typing mistake - oops]
<-------------- BEGIN SEENSHOT ------------------------>
E:\DJGPP\GPC\BUG>q bug02\ gpc bug02.pas -o bug02.exe bug02.pas: In function `program_Bug02': bug02.pas:16: incompatible types in assignment
E:\DJGPP\GPC\BUG>gpc bug02.pas -o bug02.exe bug02.pas: In function `program_Bug02': bug02.pas:15: incompatible types in assignment
E:\DJGPP\GPC\BUG>gpc bug02.pas -o bug02.exe bug02.pas: In function `program_Bug02': bug02.pas:15: incompatible types in assignment bug02.pas:16: incompatible types in assignment
E:\DJGPP\GPC\BUG>gpc bug02.pas -o bug02.exe
E:\DJGPP\GPC\BUG>bug02 OK OK 5460 5456
O OK 5460 5456
E:\DJGPP\GPC\BUG>
<-------------- END SCREENSHOT ------------------------>
What the @%^!? It compiled OK, but I forgot to use --automake! STRANGE! OK, here comes the source:
BUG02.PAS: ----------
Program Bug02; Uses Bug02_U;
{$X+}
Var ProcRec : TProcRec; S1,S2 : CString; Begin ProcRec.Name1 := @NameFunc; ProcRec.Name2 := @NameFunc;
S1 := ProcRec.Name1^; { Line 15 } S2 := ProcRec.Name1^; { Line 16 }
WriteLn(ProcRec.Name1^); WriteLn(S1); WriteLn(Word(ProcRec.Name1)); { Testing Procedure Address } WriteLn(Word(S1)); { Testing CString Address } WriteLn;
WriteLn(ProcRec.Name2^); WriteLn(S2); WriteLn(Word(ProcRec.Name2)); WriteLn(Word(S2)); WriteLn; End.
BUG02_U.PAS: ------------
Unit Bug02_U;
{$X+}
Interface
Type TProcRec = Record Name1 : ^Function : CString; Name2 : ^Function : CString; End;
Function NameFunc : CString;
Implementation
Function NameFunc : CString; Begin NameFunc := 'OK'; End;
End.
<----------------------------------------------------->
This is one of those nightmare bugs because it shows up at random times. Hang on, Ive just had an --IDEA--! Please wait while I compile once more...
DAMN - Its not unit related. Compiling the program below gave me the following error messages. NOTE: It compiled OK the first time!?!?
<-------------- BEGIN SCREENSHOT ---------------------->
E:\DJGPP\GPC\BUG>gpc bug03.pas -o bug03.exe
E:\DJGPP\GPC\BUG>gpc bug03.pas -o bug03.exe bug03.pas: In function `program_Bug02': bug03.pas:24: incompatible types in assignment
E:\DJGPP\GPC\BUG>gpc bug03.pas -o bug03.exe bug03.pas: In function `program_Bug02': bug03.pas:24: incompatible types in assignment bug03.pas:25: incompatible types in assignment
E:\DJGPP\GPC\BUG>gpc bug03.pas -o bug03.exe bug03.pas: In function `program_Bug02': bug03.pas:24: incompatible types in assignment bug03.pas:25: incompatible types in assignment
E:\DJGPP\GPC\BUG>bug03 O OK 1408960 5456
OK OK 1408960 5456
E:\DJGPP\GPC\BUG>
<-------------- END SCREENSHOT ------------------------>
BUG03.PAS: ----------
Program Bug02;
{$X+}
Type TProcRec = Record Name1 : ^Function : CString; Name2 : ^Function : CString; End;
Function NameFunc : CString; Begin NameFunc := 'OK'; End;
Var ProcRec : TProcRec; S1,S2 : CString; Begin ProcRec.Name1 := @NameFunc; ProcRec.Name2 := @NameFunc;
S1 := ProcRec.Name1^; { Line 24 } S2 := ProcRec.Name1^; { Line 25 }
WriteLn(ProcRec.Name1^); WriteLn(S1); WriteLn(Word(ProcRec.Name1)); WriteLn(Word(S1)); WriteLn;
WriteLn(ProcRec.Name2^); WriteLn(S2); WriteLn(Word(ProcRec.Name2)); WriteLn(Word(S2)); WriteLn; End.
<--------------------------------------------------------------->
I hope I dont cause too much headache with this bug report :~(
I know how bad it is hunting down bugs. I had to fix a last minute bug over the weekend - The program was scheduled to be delivered to the client on Monday (Today). Luckily it was a success! Now Ive got a week of holiday - then I go back to UNI! Busy, busy, busy -- And Im only 18!! Whats to come of the future!! AAARRGGHHH! :-)
Once again, Good Luck
________________________ | _) | | e-mail: bernie@icenet.com.au |___)ernhard |_|schirren ptschirrenb@cc.curtin.edu.au www: www.geocities.com/CollegePark/Quad/8070/