HP3000-L Archives

September 2000, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Wed, 13 Sep 2000 21:40:51 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
Tony Summers <[log in to unmask]> wrote:
> I have a cobol subprogram that has 4 parameters
> I have called that subprogram from my main program twice - once
> with all 4 parameters and once with just two.
[snip]
> Can anyone suggest a method that prevents the program from
> either being compiled in the first place or have
> I discovered a little known bug in the loader ?

I can suggest one way to detect the problem:  Try compiling in
Compatibility Mode.  The COBOL II/V compiler didn't permit
calling the same subroutine with different numbers of parameters
and would produce an error message.

You are not the first to discover this behavior.  It is described
in Service Request 1653117044, "COBOL II/iX fails to give diagnostic
when parameter counts differ".  Here are some excerpts.

Problem:

"Parameter checking in COBOL II/iX is incomplete.  If a COBOL program
has several calls to a COBOL subprogram in an executable library (XL),
and at least one of the CALL statements has the correct number of
parameters, then an incorrect call with the wrong number of parameters
may go undetected.  Neither the compiler, nor the link editor, nor the
loader will detect the mismatch, in some cases.

"When the incorrect CALL statement is executed, the program may behave
strangely.  An attempt by the subprogram to access a parameter that
was not passed is likely to result in a Data Memory Protection Trap or
other program abort."

Cause:

"The COBOL II/iX compiler does not check for inconsistent parameter
counts in different calls to the same subprogram.  Such calls would be
legitimate when calling certain non-COBOL subprograms, for example
Pascal/iX procedures declared with OPTION EXTENSIBLE.

"The link editor picks one of the CALL statements to generate the
parameter checking information to be passed on to the loader.  The
loader must do the actual checking after it locates the called
subroutine in the XL.  If the link editor chooses one of the calls with
the wrong number of parameters, then the loader will report "PARMCHECK
MISMATCH ARGUMENT COUNT" and refuse to load the program.  But if the
link editor happens to generate its parameter checking information from
one of the valid CALL statements, the loader will not detect a problem."

Fix:

"There are no plans to address this problem in the COBOL II/iX compiler.
The problem is not unique to COBOL; the same problem has been reported
with FORTRAN 77/iX.  There is an enhancement request against LINKEDITOR,
SR 4701234872, to improve the way it gathers parameter checking
information.  It could merge information from the various subroutine
calls in a program, passing along enough information for the loader to
detect the problem."

Walter Murray
Hewlett-Packard
COBOL II/iX

ATOM RSS1 RSS2