[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] found a bug in the open-cobol runtime-system (or compi

From: Christian . Groove . extern
Subject: [open-cobol-list] found a bug in the open-cobol runtime-system (or compiler as you like)
Date: Wed Apr 3 06:57:44 2002


A) the situation
I wrote a server (in C), that calls a cobol subprogram. In order to
distinguish between several modes insode the cobol code,
i declared a swith over several modes. The switch is a 

     SELECTOR          PIC 9(4)  BINARY.

The call is performed from C by means of a simple "external" function
call and the cobol code is compiled in static and -m mode.
Later i bound both, the C and the COB object files together.

B) what happened
After calling the COBOL subprogram, the application caused a
SEGViolation inside the function __gmpz_set_si().
The stack looks like this:


C) The problem
When calling a sub-program, wether coblib nor the compiled
intermediate C code calls the cob_init_math() function, that
in turns initialize the gmp-functions. 
A direct subprogramm call will not initialize a internal stack
for numerics. On this ground cob_decimal_set_int() will
pass an illegal pointer reference to the gmp functions that
cause the crash !!!

C) The solution
I once call cob_init_math() by my own from the c code.
If the compiler would do this for me, then the run-time
system would require an application wide register, that
allows to initialze the registers once for any other 
subprograms, or you use a hidden initialize register
inside libcob.


targit GmbH bei:
Christian Groove
HVB Systems GmbH
Quadriga Haus 3
Apianstr. 2 - 6
85774 Unterföhring
Intern:         STX4
Phone:          +49-89-378-31595
Mobile:         +49-160-382 6915
Fax:            +49-89-378-31828
mailto: address@hidden              

reply via email to

[Prev in Thread] Current Thread [Next in Thread]