bug-gnucobol
[Top][All Lists]
Advanced

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

RE: [open-cobol-list] Bug Report and Bug Fix


From: Robert Sherry
Subject: RE: [open-cobol-list] Bug Report and Bug Fix
Date: Sat Apr 1 20:44:01 2006

Sergey,

 

            When I wrote SCCS, I meant sourceforge. Maybe that was not clear.

 

Bob Sherry

 


From: address@hidden [mailto:address@hidden On Behalf Of Sergey Kashyrin
Sent: Saturday, April 01, 2006 9:31 PM
To: Robert Sherry; address@hidden
Subject: Re: [open-cobol-list] Bug Report and Bug Fix

 

Robert,

 

Thanks for reporting.

It's definitely a bug.

 

And another small problem is that all of that functions are "inline".

Better they to be regular, in this case you don't need to recompile all your programs :-(

 

Regards,

Sergey

 

 

----- Original Message -----

Sent: Saturday, April 01, 2006 9:31 AM

Subject: [open-cobol-list] Bug Report and Bug Fix

 

 

            With the March release of the Open Source COBOL Compiler, the following program does not produce the expected output:

 

       ID DIVISION.

       PROGRAM-ID.      ADD1.

       ENVIRONMENT      DIVISION.

       CONFIGURATION SECTION.

       INPUT-OUTPUT SECTION.

       FILE-CONTROL.

       DATA DIVISION.

       FILE SECTION.

       WORKING-STORAGE SECTION.

 

        01 C1 PIC 9(4) USAGE IS COMP-5.

       PROCEDURE DIVISION.

        MOVE 100 TO C1.

        DISPLAY C1

        SUBTRACT 10 FROM C1.

        DISPLAY C1

        SUBTRACT 9 FROM C1.

        DISPLAY C1

        GOBACK.

 

Instead of subtracting from the data item C1, the program adds to the variable C1. If C1 had been declared as COMP then the above program would have worked. Please consider the file codegen.h. This file defines the routine cob_addsub_u16_binary. This routine performs either an addition or a subtraction on a data item. In certain cases, before the addition or subtract can be done, the data item needs to be converted. For the case that the macro  WORDS_BIGENDIAN is def defined and COB_FIELD_BINARY_SWAP (f) is off the routine only does an add. This can be fixed by replacing the statement:

        *(unsigned short *)p += val;

with:

        if (!addsub) {

            *(unsigned short *)p += val;

        } else {

            *(unsigned short *)p -= val;

        }

 

I claim that the following routines also have the same problem:

cob_addsub_s16_binary, cob_addsub_u32_binary, cob_addsub_s32_binary, cob_addsub_u64_binary, cob_addsub_s64_binary

 

I would be happy to check my change in to SCCS system, if that is the appropriate thing to do.


reply via email to

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