Orlando Llanes wrote:
Before I begin, the reason I didn't notice this at first is because
the previous version of GPC compiled my program without a problem despite the following... I use external assembly routines that access variables declared in a Pascal unit (the assembler doesn't matter, it happens with both AS and NASM). To declare the variables defined in the Pascal unit, I declared them "common". Then I changed all "common" references to global references and added declarations in the .data section and the program no longer crashed. Weird.
Fine to hear so. However, did you find out what the previous GPC did differently so the problem did not occur? If you still have that version installed, can you compare the -S output of the previous and the current GPC version to see what's different? (Just to be sure it really isn't a code generation problem...)
Frank
On Sat, 10 Oct 1998, Frank Heckenbach wrote:
Fine to hear so. However, did you find out what the previous GPC did ... code generation problem...)
Will do, I'm going to write a "dummy" program this time since I know now where the problem occurs. I think you should know that GCC does the same thing (I know this because of a test program that came with NASM that declared some things "common"). I'll post it in my next message.
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414
On Sat, 10 Oct 1998, Frank Heckenbach wrote:
differently so the problem did not occur? If you still have that version installed, can you compare the -S output of the previous and the current GPC version to see what's different? (Just to be sure it really isn't a code generation problem...)
I re-installed the previous version exactly as I had it before with GCC 2.7.2.1 and everything, but could not reproduce the error! It's a miracle that it never crashed before.. There is one thing tho, it seems that variables declared within the program are not properly exported outside of the source module. I attatched a simple example program to show what I mean.
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414
.globl _setcommonvar
.lcomm _Commonvar 4
.globl _globalvar
.globl _foo
.text
_setcommonvar:
movl (_globalvar), %eax
movl %eax, (_Commonvar)
movl %eax, (_foo)
ret
.data
_globalvar: .long 714
_foo: .long 0
PROGRAM COM;
VAR
{ GPC declared variable }
CommonVar : Cardinal;
{ Externally declared variables }
GlobalVar : ASMName 'globalvar' Cardinal;
Foo : ASMName 'foo' Cardinal;
{ External assembly routine }
PROCEDURE SetCommonVar; C;
BEGIN
CommonVar := 0;
GlobalVar := 714;
SetCommonVar;
WriteLn;
WriteLn( 'CommonVar = ', CommonVar:4, ' should be ', GlobalVar );
WriteLn( ' Foo = ', Foo:4, ' should be ', GlobalVar );
WriteLn;
END.