[Top][All Lists]

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

[open-cobol-list] Problem calling a known void function

From: Ehud Karni
Subject: [open-cobol-list] Problem calling a known void function
Date: Tue, 26 May 2009 20:07:19 +0300

Hello All,

I'm the system programmer of Mivtach-Simon. One of the programmers
here had a problem when he used CALL with void function like `free'.

An example program:

       identification division.
       program-id. test-free.
       data        division.
       working-storage section.
       01 pntr usage pointer.
       01 len-rec  pic 999 value 100.
       linkage    section.
       01 rec pic x(100).
       procedure  division.
           call "malloc" using value len-rec returning pntr.
           display "pntr=" pntr.
           set address of rec to pntr.
           move "123" to rec.
           display rec.
           call "free" using rec.
           move 0 to return-code
           stop run.

The gcc emits the following error -
test_free.c:140: error: void value not ignored as it ought to be
which is referencing this produced c code:
  /* test_free.opc:15: CALL */

      module.cob_procedure_parameters[0] = ( = b_7, &f_7);
      module.cob_procedure_parameters[1] = NULL;
      module.cob_procedure_parameters[2] = NULL;
      module.cob_procedure_parameters[3] = NULL;
      module.cob_procedure_parameters[4] = NULL;
      cob_call_params = 1;
      (*(int *) (b_1)) = free (b_7);       <--- error

I checked the ISO standard (ISO/IEC 1989:200x WD 1.10) and did not
find any syntax to say "not returning".

The bypass solution now is to wrap the `free' call, like:

int int_free (void *ptr)
    free ( ptr ) ;
    return ( 0 ) ;

but we will appreciate a better non-specific solution.


 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <>    Better Safe Than Sorry

reply via email to

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