gm2
[Top][All Lists]
Advanced

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

Re: Cumbersome error messages with CMPLX() / RE() / IM()


From: Gaius Mulley
Subject: Re: Cumbersome error messages with CMPLX() / RE() / IM()
Date: Thu, 30 Nov 2023 17:50:51 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Michael Riedl <udo-michael.riedl@t-online.de> writes:

> Gaius,
>
> may I ask you to cross-check the following short code:
>
> MODULE TstCmplx;
>
> PROCEDURE MkCmplx(re,im : REAL) : COMPLEX;
>
> BEGIN
>       RETURN CMPLX(re,im);
> END MkCmplx;
>
> VAR   re,im : REAL;
>          x       : COMPLEX;
> BEGIN
>
>       x  := MkCmplx(2.0,1.0);
>       re := RE(x);
>       im := IM(x);
>
>
> END TstCmplx.
>
>
> On my side it produces quite some strange error messages (using GM2
> version 13.2.1 20231123):
>
> mriedl@laptop:~/Modula-2/GM2/bug1$gm2 TstCmplx.mod
> TstCmplx.mod:6:14: error: In procedure 'MkCmplx': too many parameters,
> 1 passed to 'CMPLX'
>     6 |       RETURN CMPLX(re,im);
>       |              ^~~~~
> TstCmplx.mod:6:14: error: attempting to pass too many parameters to
> procedure 'CMPLX', the 2nd parameter does not exist
> TstCmplx.mod:6:14: error: attempting to pass too many parameters to
> procedure 'CMPLX', the 1st parameter does not exist
> TstCmplx.mod:6:14: error: attempting to pass (2) parameters to
> procedure (CMPLX) which was declared with (0) parameters
> <built-in>: error: attempting to pass (2) parameters to procedure
> (CMPLX) which was declared with (0) parameters
> TstCmplx.mod:6:14: error: too many parameters, 2 passed to 'CMPLX'
> TstCmplx.mod:14:13: error: In program module 'TstCmplx': attempting to
> pass too many parameters to procedure 'RE', the 1st parameter does not
> exist
>    14 |       re := RE(x);
>       |             ^~
> TstCmplx.mod:14:13: error: attempting to pass (1) parameters to
> procedure (RE) which was declared with (0) parameters
> <built-in>: error: attempting to pass (1) parameters to procedure (RE)
> which was declared with (0) parameters
> TstCmplx.mod:14:13: error: too many parameters, 1 passed to 'RE'
> TstCmplx.mod:15:13: error: attempting to pass too many parameters to
> procedure 'IM', the 1st parameter does not exist
>    15 |       im := IM(x);
>       |             ^~
> TstCmplx.mod:15:13: error: attempting to pass (1) parameters to
> procedure (IM) which was declared with (0) parameters
> <built-in>: error: attempting to pass (1) parameters to procedure (IM)
> which was declared with (0) parameters
> TstCmplx.mod:15:13: error: too many parameters, 1 passed to 'IM'
>
> Thanks
>
> Michael

Hi Michael,

ah yes thanks for the bug report - it should be saying CMPLX does not
exist for pim (rather than a use partially declared standard procedure
function with no declared parameters!):

$ gm2 -c -fiso TstCmplx.mod

works as expected though.  I'll remove CMPLX from -fpim[234]

regards,
Gaius



reply via email to

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