gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] Internal compiler error


From: Michael Anderson
Subject: Re: [open-cobol-list] Internal compiler error
Date: Fri, 28 Jun 2013 00:26:16 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7

You problem might be the "move address of buf to byteCast " statement, byteCast is not a address pointer. Maybe look at using "set" instead of "move". The Cobol "Move" statement implies many things, it does casting automatically, but only if it can, or if it is possible.

Address are special data types, so if you must use "move" to copy an address from one var to another, you can try to redefine the pointer to a "pic 9(9) or 9(18)" first, then move the "pic 9(9)/9(18)" to another var. (still problematic with 32/64 bit issues) and Yes the error should better explain the problem.

The moral of the story: Use "set" to copy addresses.

Not sure what you're trying to accomplish, but try this:

       IDENTIFICATION DIVISION.
       PROGRAM-ID.     HELLOWORLD.

      *
       ENVIRONMENT DIVISION.

       DATA DIVISION.
       working-storage section.

       01 buf pic x(256) usage is display.
       01 address-of-buf usage is pointer.

       PROCEDURE DIVISION.

           DISPLAY "Hello world!"
           accept buf.
           set address-of-buf to address of buf.
           display address-of-buf.
           STOP RUN.
           EXIT.

On 06/27/2013 09:40 PM, Charles Anthony wrote:
$ cobc -x hw.cob
Invalid tree tag 14
typeck.c:4317: Internal compiler error
Aborting compile of hw.cob at line 19


$ cat hw.cob
        IDENTIFICATION DIVISION.
        PROGRAM-ID.     HELLOWORLD.

       *
        ENVIRONMENT DIVISION.

        DATA DIVISION.
        working-storage section.

        01 buf pic x(256) usage is display.
        01 byteCast based.
            05 byteCasted usage binary-char unsigned.

        PROCEDURE DIVISION.

            DISPLAY "Hello world!"
            accept buf
            move address of buf to byteCast
            display byteCasted
            STOP RUN.
            EXIT.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list



reply via email to

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