Hi, Ron.
Then I guess it’s pistols at dawn. Because I just double-checked: 3.1dev.0, packaged yesterday, built today(straight ./configure, with no options) , and I’m seeing
00000000 35 30 00 0a 35 0a 2e 30 35 0a |50..5..05.|
My seconds will be in touch with your people.
Or, maybe, if I can find some time, I’ll dig into it. Certainly there is not much point in you digging, if you can’t reproduce it.
Your quick response is impressive. Thanks.
Bob Dubner
From: Ron Norman <address@hidden>
Sent: Thu, November 28, 2019 18:02
To: Robert Dubner <address@hidden>
Cc: address@hidden
Subject: Re: Display of VAR1 PICTURE 9P includes an 0x00 NULL character
This same program using Microfocus COBOL outputs the following:
---Mem Dump<[/tmp/foo]>--
000000:35 0a 35 0a 35 0a 5.5.5.
And using GnuCOBOL (current development version) I get:
--Mem Dump<[/tmp/foo]>--
000000:35 30 0a 35 0a 2e 30 35 - 0a 50.5..05.
Hello, folks. My name is Bob Dubner, I work at the Symas Corporation.
I'm new to open software development, but I'm certainly not new to
debugging. So, I am supplying the information that I figured would be
helpful.
I have not made an effort to find where in the cobc code the error might
be found.
If there is a preferred way of reporting problems, please let me know.
Bob Dubner
========
Statement of problem:
DISPLAY of a variable with a greater than 1.00 P-scaled PICTURE string
generates
a string that ends with a 0x00 NULL before the newline.
Demonstration session:
bob@doobie:~/projects/cobol/bug$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
bob@doobie:~/projects/cobol/bug$ uname -a
Linux doobie 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019
x86_64 x86_64 x86_64 GNU/Linux
bob@doobie:~/projects/cobol/bug$ cobc --version
cobc (GnuCOBOL) 3.1-dev.0
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward
Hart
Built Nov 28 2019 16:36:43
Packaged Nov 27 2019 22:35:50 UTC
C version "7.4.0"
bob@doobie:~/projects/cobol/bug$ cat bug.cbl
IDENTIFICATION DIVISION.
PROGRAM-ID. QWIK-CHECK.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 VAR1 PICTURE 9P VALUE 50 .
01 VAR2 PICTURE 9 VALUE 5 .
01 VAR3 PICTURE P9 VALUE 0.05 .
PROCEDURE DIVISION.
DISPLAY VAR1
DISPLAY VAR2
DISPLAY VAR3
STOP RUN.
bob@doobie:~/projects/cobol/bug$ cobc -x bug.cbl
bob@doobie:~/projects/cobol/bug$ ./bug >bug.txt
bob@doobie:~/projects/cobol/bug$ hexdump -C bug.txt
00000000 35 30 00 0a 35 0a 2e 30 35 0a |50..5..05.|
0000000a
Note that the third character in bug.txt is an 0x00 NULL.
--