memory bounds error and weird compilation messages 
Author Message
 memory bounds error and weird compilation messages

Hi

I am trying to write a program that calls a function in a C module.
The call statement in the Cobol is;

CALL "get_pid" USING MY-PID.

where MY-PID is

77 MY-PID               PIC 9(9) COMP-5.

When I compile and run it, I get;

Attempt to access item beyond bounds of memory (Signal 10).

This happens if I try to reference the contents of the variable AT
ALL. Even using printf inside the C module crashes it.

When I compile the program, I get the following messages (not all of
them, because there are heaps!);

cob -x -C nowarning nofmainm.cbl tcpnof.o noferror.o noftimer.o -lxnet
warning: Text relocation remains                referenced

    against symbol                  offset      in file
_
_mFa603X                            0x2d4
/u01/cobol/coblib/libasmcrtn.a(\
routines.o)
_
_mFa603X                            0x2d0
/u01/cobol/coblib/libasmcrtn.a(\
routines.o)
_
_mF8301X                            0x274
/u01/cobol/coblib/libasmcrtn.a(\
routines.o)
_
_mF8301X                            0x270
/u01/cobol/coblib/libasmcrtn.a(\
routines.o)
-

Any ideas or help would be greatly appreciated.

Ta.



Sat, 25 Jan 2003 03:00:00 GMT  
 memory bounds error and weird compilation messages
Can you show us how the C function is expecting to "receive" the passed
parameter?  Any chance that it is expecting it to be "on the stack" (or in
COBOL "BY VALUE")?

--
Bill Klein
    wmklein <at> ix dot netcom dot com

Quote:
> Hi

> I am trying to write a program that calls a function in a C module.
> The call statement in the Cobol is;

> CALL "get_pid" USING MY-PID.

> where MY-PID is

> 77 MY-PID PIC 9(9) COMP-5.

> When I compile and run it, I get;

> Attempt to access item beyond bounds of memory (Signal 10).

> This happens if I try to reference the contents of the variable AT
> ALL. Even using printf inside the C module crashes it.

> When I compile the program, I get the following messages (not all of
> them, because there are heaps!);

> cob -x -C nowarning nofmainm.cbl tcpnof.o noferror.o noftimer.o -lxnet
> warning: Text relocation remains                referenced

>     against symbol                  offset      in file
> _
> _mFa603X                            0x2d4
> /u01/cobol/coblib/libasmcrtn.a(\
> routines.o)
> _
> _mFa603X                            0x2d0
> /u01/cobol/coblib/libasmcrtn.a(\
> routines.o)
> _
> _mF8301X                            0x274
> /u01/cobol/coblib/libasmcrtn.a(\
> routines.o)
> _
> _mF8301X                            0x270
> /u01/cobol/coblib/libasmcrtn.a(\
> routines.o)
> -

> Any ideas or help would be greatly appreciated.

> Ta.



Sat, 25 Jan 2003 03:00:00 GMT  
 memory bounds error and weird compilation messages
Ok, the C function is this;

int get_pid(int *pid)
{

    int a;

    *pid=getpid();

  return 0;

Quote:
}

The idea is that the cobol app will get its process id, using the c
functions.

BYW, I am running Solaris 2.6, C compiler is gcc 2.95.2, Cobol is MF
Cobol 4.1

On Tue, 8 Aug 2000 19:04:25 -0500, "William M. Klein"

Quote:

>Can you show us how the C function is expecting to "receive" the passed
>parameter?  Any chance that it is expecting it to be "on the stack" (or in
>COBOL "BY VALUE")?

>--
>Bill Klein
>    wmklein <at> ix dot netcom dot com


>> Hi

>> I am trying to write a program that calls a function in a C module.
>> The call statement in the Cobol is;

>> CALL "get_pid" USING MY-PID.

>> where MY-PID is

>> 77 MY-PID PIC 9(9) COMP-5.

>> When I compile and run it, I get;

>> Attempt to access item beyond bounds of memory (Signal 10).

>> This happens if I try to reference the contents of the variable AT
>> ALL. Even using printf inside the C module crashes it.

>> When I compile the program, I get the following messages (not all of
>> them, because there are heaps!);

>> cob -x -C nowarning nofmainm.cbl tcpnof.o noferror.o noftimer.o -lxnet
>> warning: Text relocation remains                referenced

>>     against symbol                  offset      in file
>> _
>> _mFa603X                            0x2d4
>> /u01/cobol/coblib/libasmcrtn.a(\
>> routines.o)
>> _
>> _mFa603X                            0x2d0
>> /u01/cobol/coblib/libasmcrtn.a(\
>> routines.o)
>> _
>> _mF8301X                            0x274
>> /u01/cobol/coblib/libasmcrtn.a(\
>> routines.o)
>> _
>> _mF8301X                            0x270
>> /u01/cobol/coblib/libasmcrtn.a(\
>> routines.o)
>> -

>> Any ideas or help would be greatly appreciated.

>> Ta.



Sun, 26 Jan 2003 03:00:00 GMT  
 memory bounds error and weird compilation messages

Quote:

> Ok, the C function is this;

> int get_pid(int *pid)
> {

>     int a;

>     *pid=getpid();

>   return 0;
> }

> The idea is that the cobol app will get its process id, using the c
> functions.

> BYW, I am running Solaris 2.6, C compiler is gcc 2.95.2, Cobol is MF
> Cobol 4.1

> On Tue, 8 Aug 2000 19:04:25 -0500, "William M. Klein"

> >Can you show us how the C function is expecting to "receive" the passed
> >parameter?  Any chance that it is expecting it to be "on the stack" (or in
> >COBOL "BY VALUE")?

> >--
> >Bill Klein
> >    wmklein <at> ix dot netcom dot com


> >> Hi

> >> I am trying to write a program that calls a function in a C module.
> >> The call statement in the Cobol is;

> >> CALL "get_pid" USING MY-PID.

> >> where MY-PID is

> >> 77 MY-PID PIC 9(9) COMP-5.

> >> When I compile and run it, I get;

> >> Attempt to access item beyond bounds of memory (Signal 10).

> >> This happens if I try to reference the contents of the variable AT
> >> ALL. Even using printf inside the C module crashes it.

> >> When I compile the program, I get the following messages (not all of
> >> them, because there are heaps!);

> >> cob -x -C nowarning nofmainm.cbl tcpnof.o noferror.o noftimer.o -lxnet
> >> warning: Text relocation remains                referenced

> >>     against symbol                  offset      in file
> >> _
> >> _mFa603X                            0x2d4
> >> /u01/cobol/coblib/libasmcrtn.a(\
> >> routines.o)
> >> _
> >> _mFa603X                            0x2d0
> >> /u01/cobol/coblib/libasmcrtn.a(\
> >> routines.o)
> >> _
> >> _mF8301X                            0x274
> >> /u01/cobol/coblib/libasmcrtn.a(\
> >> routines.o)
> >> _
> >> _mF8301X                            0x270
> >> /u01/cobol/coblib/libasmcrtn.a(\
> >> routines.o)
> >> -

> >> Any ideas or help would be greatly appreciated.

> >> Ta.

Why use 'C' when you can use it straight from COBOL...

 working-storage section.
 *> NB: mypid size may change from OS 2 OS..check pid_t size..
 01 mypid pic s9(9) comp-5.
 procedure division.
  call "getpid" returning mypid
  display "MYPID : " mypid

PS: You assume a "process id" is the same size as a integer, this may not be true for
some OS's... try to use "pid_t" instead of int in the 'C' and change the size of mypid
in the COBOL if required.

--

ACT Development, The Lawn, Newbury, UK.
URL: http://www.merant.com



Sun, 26 Jan 2003 03:00:00 GMT  
 memory bounds error and weird compilation messages
Chris,

This *might* be an alignment problem (where the 'int' you have declared
in COBOL is not on a valid boundary for the indirection (*pid) to work).
In general, if you're passing 01 or 77 level items, this shouldn't be
the case, but there are directives which affect this, so I'll mention it
anyway.

Try doing a byte-for-byte copy:

int get_pid(int *pid)
{
    int p;
    p = getpid();
    memcpy((void *)pid, (void *)&p, sizeof(int));
    return 0;

Quote:
}

If that works (and therefore alignment is the problem), then the
declaration 'int *pid' is misleading and should be changed (for your
sanity at some point in the future when maintaining the code!).

If your version of MF COBOL have them, check out files called
'ugetput.h' (or 'getput.h') and 'mf_types.h' somewhere under $COBDIR
($COBDIR/src ??). These files have type and macro declarations that
allow you to write this code portably and still get best performance
(eg, on a chip which is tolerant of misalignment, the macro *will* just
do a pointer indirection).

.. of course, you *could* always code directly to getpid():

CALL "getpid" RETURNING MY-PID

Cheers, Kev.

Quote:

> Ok, the C function is this;

> int get_pid(int *pid)
> {

>     int a;

>     *pid=getpid();

>   return 0;
> }

> The idea is that the cobol app will get its process id, using the c
> functions.

> BYW, I am running Solaris 2.6, C compiler is gcc 2.95.2, Cobol is MF
> Cobol 4.1



Sun, 26 Jan 2003 03:00:00 GMT  
 memory bounds error and weird compilation messages
Thanks for your help! I tried your suggestion, and that worked fine!
So, I have an alignment problem.

When I compile the cobol program, I get the following output. These
'text relocation remains against symbol' messages, could they be part
of the alignment problem. Where do I start to look for a solution to
this.

Thanks.

**** output of make ****
make -k nofmainm
# Compiling The MasterCard Driver Program
cob -x -C nowarning nofmainm.cbl tcpnof.o noferror.o noftimer.o -lxnet
warning: Text relocation remains                referenced
    against symbol                  offset      in file
_mFa603X                            0x2d0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa603X                            0x2d4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF8301X                            0x274
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF8301X                            0x270
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF5903X                            0x1b0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF5903X                            0x1b4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa604X                            0x2e4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa604X                            0x2e0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF6902X                            0x1e0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF6902X                            0x1e4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4802X                            0xe0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4802X                            0xe4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa803X                            0x334
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa803X                            0x330
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4901X                            0x110
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4901X                            0x114
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4902X                            0x120
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4902X                            0x124
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF6904X                            0x204
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF6904X                            0x200
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4803X                            0xf4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4803X                            0xf0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4804X                            0x100
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4804X                            0x104
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF5904X                            0x1c0
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF5904X                            0x1c4
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4904X                            0x144
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4904X                            0x140
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF7001X                            0x230
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF7001X                            0x234
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF3002X                            0x14
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF3002X                            0x10
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF7003X                            0x250
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF7003X                            0x254
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF8303X                            0x294
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF8303X                            0x290
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF3005X                            0x40
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF3005X                            0x44
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa802X                            0x324
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa802X                            0x320
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4903X                            0x130
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF4903X                            0x134
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa804X                            0x340
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mFa804X                            0x344
/u01/cobol/coblib/libasmcrtn.a(routines.o)
_mF5616                             0x7ec       nofmainm.o
_mF5616                             0x870       nofmainm.o
_mF5616                             0xafb0      nofmainm.o
_mF6801                             0x6518      nofmainm.o
_mF6801                             0x6488      nofmainm.o
_mF6801                             0x9218      nofmainm.o
_mF6801                             0x923c      nofmainm.o
_mF6801                             0x9268      nofmainm.o
_mF6801                             0x928c      nofmainm.o
_mF6801                             0x934c      nofmainm.o
_mF6801                             0x92e8      nofmainm.o
_mF6801                             0x9478      nofmainm.o
_mF6801                             0x94a4      nofmainm.o
_mF6801                             0x94c8      nofmainm.o
_mF6801                             0x6424      nofmainm.o
_mF6801                             0x63c0      nofmainm.o
_mF6801                             0xa234      nofmainm.o
_mF6801                             0x93b0      nofmainm.o
_mF6801                             0x635c      nofmainm.o
_mF6801                             0xa7ec      nofmainm.o
_mF6801                             0xac24      nofmainm.o
_mF6801                             0x9414      nofmainm.o
_mF6801                             0x64ec      nofmainm.o
_mF6801                             0xeeac      nofmainm.o
_mF6801                             0xf97c      nofmainm.o
_mF6801                             0x6300      nofmainm.o
_mF6801                             0x62dc      nofmainm.o
_mF6801                             0x62b0      nofmainm.o
_mF6801                             0x628c      nofmainm.o
_mF6801                             0x5c84      nofmainm.o
_mF6801                             0xfa38      nofmainm.o
_mF6801                             0x5b14      nofmainm.o
_mF6801                             0x10fdc     nofmainm.o
_mF6801                             0xf4dc      nofmainm.o
_mF6801                             0xb4ac      nofmainm.o
_mF6801                             0x5af0      nofmainm.o
_mF6801                             0xf610      nofmainm.o
_mF6801                             0x5a48      nofmainm.o
_mF6801                             0x58b4      nofmainm.o
_mF6801                             0xf634      nofmainm.o
_mF6801                             0x10f6c     nofmainm.o
_mF6801                             0x5794      nofmainm.o
_mF6801                             0x5628      nofmainm.o
_mF6801                             0xb62c      nofmainm.o
_mF6801                             0xb7b4      nofmainm.o
_mF6801                             0x4a5c      nofmainm.o
_mF6801                             0x4798      nofmainm.o
_mF6801                             0xf900      nofmainm.o
_mF6801                             0x10770     nofmainm.o
_mF6801                             0xbc68      nofmainm.o
_mF6801                             0x11044     nofmainm.o
_mF6801                             0x1074c     nofmainm.o
_mF6801                             0x1116c     nofmainm.o
_mF6801                             0x10598     nofmainm.o
_mF6801                             0xbef0      nofmainm.o
_mF6801                             0xbf34      nofmainm.o
_mF6801                             0xc0cc      nofmainm.o
_mF6801                             0x111b4     nofmainm.o
_mF6801                             0xc238      nofmainm.o
_mF6801                             0x10474     nofmainm.o
_mF6801                             0x10450     nofmainm.o
_mF6801                             0x10214     nofmainm.o
_mF6801                             0x10114     nofmainm.o
_mF6801                             0xef74      nofmainm.o
_mF6801                             0xd164      nofmainm.o
_mF6801                             0x680       noftimer.o
_mF6801                             0xd4f8      nofmainm.o
_mF6801                             0xdca4      nofmainm.o
_mF6801                             0xdd58      nofmainm.o
_mF6801                             0xde0c      nofmainm.o
_mF6801                             0xdec0      nofmainm.o
_mF6801                             0xdf30      nofmainm.o
_mF6801                             0xe2dc      nofmainm.o
_mF6801                             0xe3a0      nofmainm.o
_mF6801                             0xe464      nofmainm.o
_mF6801                             0xe528      nofmainm.o
_mF6801                             0xe598      nofmainm.o
_mF6801                             0x10908     nofmainm.o
_mF6801                             0x33e0      nofmainm.o
_mF6801                             0x93c       noftimer.o
_mF6801                             0xf18c      nofmainm.o
_mF6801                             0xf1b0      nofmainm.o
_mF6801                             0xf384      nofmainm.o
_mF6801                             0xf4b8      nofmainm.o
_mF6801                             0x11a88     nofmainm.o
_mF6801                             0x3a4       noftimer.o
_mF6801                             0x16a0      nofmainm.o
_mF6801                             0xec4       nofmainm.o
_mF6801                             0xfff0      nofmainm.o
_mF6801                             0xfc84      nofmainm.o
_mF6801                             0x1092c     nofmainm.o
_mF6801                             0xfda8      nofmainm.o
_mF6801                             0xfecc      nofmainm.o
_mF6801                             0x10d08     nofmainm.o
_mF6801                             0xcb8       noftimer.o
_mF6801                             0xfb60      nofmainm.o
_mF5216                             0xa514      nofmainm.o
_mF5216                             0xd3b8      nofmainm.o
_mF5216    
...

read more »



Sun, 26 Jan 2003 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. MF error # 114:Attempt to assess item beyond bounds of memory

2. Weird error message

3. Large memory program compilation error

4. oe20 fatal error, out of memory message

5. Memory Low Error Message

6. memory error messages

7. CA-Clipper Error Message : 'MEMORY LOW'

8. 'Memory is full' error message

9. Ultrix-32 Virtual memory PDP-11 fortran 77 error message

10. Not enough free memory for buffer image error message

11. Error BASE/1132 Bound error: array access

12. Error BASE/1187 Bound Error: AADD!!!

 

 
Powered by phpBB® Forum Software