gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] [GNU Cobol 2.0] crash on Solaris (sparc) while exe


From: HECHT, G JOHN
Subject: Re: [open-cobol-list] [GNU Cobol 2.0] crash on Solaris (sparc) while executing SET ADDRESS OF Y2 UP BY 4
Date: Mon, 15 Dec 2014 14:59:58 +0000

Have you tried W-DUMMY. I never recommend using a correctly spelled word for any user defined object.  John H

 

From: address@hidden [mailto:address@hidden
Sent: Monday, December 15, 2014 8:51 AM
To: James Lemmon
Cc: address@hidden
Subject: Re: [open-cobol-list] [GNU Cobol 2.0] crash on Solaris (sparc) while executing SET ADDRESS OF Y2 UP BY 4

 

EXTERNAL SENDER. DO NOT click links if sender is unknown. DO NOT provide your user ID or password.

 

Hello,

I am calling prog from a this small program

       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      CALL-IT.
       DATA             DIVISION.
       WORKING-STORAGE  SECTION.
       01   DUMMY PIC X(4).

       PROCEDURE        DIVISION.

       CALL "prog" USING DUMMY      
         STOP RUN.

the module prog.cob:

       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      prog.
       DATA             DIVISION.
       WORKING-STORAGE  SECTION.
       01 XX.
         02 XX-1           PIC X(4) VALUE "1234".
         02 XX-2           PIC X(4) VALUE "5678".
       01 P-XX-1        POINTER.
       01 P-XX-2        POINTER.
       LINKAGE          SECTION.
       01 Y2            PIC X(4).
       PROCEDURE        DIVISION USING Y2.

       
         SET P-XX-1 TO ADDRESS OF XX-1
         SET P-XX-2 TO ADDRESS OF XX-2
         SET ADDRESS OF Y2 TO ADDRESS OF XX-1
         SET ADDRESS OF Y2 UP BY 4
         IF Y2 NOT = XX-2
            DISPLAY "Test 2 '" Y2 "'"
            END-DISPLAY
         END-IF
         IF ADDRESS OF Y2 NOT= P-XX-2
            DISPLAY "Pointer test failed"
         END-IF
         STOP RUN.
         

compile command: cobc -g -x call-it.cob prog.cob

the generated C code for prog.cob

int
prog (cob_u8_t *b_10)
{
  return prog_ (0, b_10);
}

static int
prog_ (const int entry, cob_u8_t *b_10)
{
  /* Program local variables */
  #include "prog.c.l.h"

  /* Start of function code */

... many lines omitted

  /* Line: 17        : SET                : prog.cob */
  cob_set_location (st_1, 17, NULL, NULL, st_2);
  {
    void *temp_ptr;
    temp_ptr = b_5;
    b_10 = temp_ptr;
  }

  /* Line: 18        : SET                : prog.cob */
  cob_set_location (st_1, 18, NULL, NULL, st_2);
  cob_pointer_manip (b_10, (cob_field *)&c_1, 0);


... rest of C code omitted.

and these are the compiler warnings:

prog.c: In function 'prog_':
prog.c:116:3: warning: passing argument 1 of 'cob_pointer_manip' from incompatible pointer type
prog.c.h:33:1: note: expected 'struct cob_field *' but argument is of type 'unsigned char *'



Best Regards

Paul Meinhardt  
(Development)


reply via email to

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