bugModula-2 Compiler and Translator - Bugs: bug #43286, Nested functio calls fail

 
 

bug #43286: Nested functio calls fail

Submitter:  Peter De Wachter <pdewacht>
Submitted:  Tue 23 Sep 2014 11:21:53 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Confirmed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 24 Feb 2015 10:56:15 PM UTC, comment #6: 

Compiling my simpler version of Peter's program with 'm2c -C -all' exposes C double assigning variables, thus losing parameter values when nested:

(par_WriteCard_InOut._x=((par_add_Bug._i=(11),par_add_Bug._j=((par_add_Bug._i=(100),par_add_Bug._j=(1000),_add_Bug(&par_add_Bug))),_add_Bug(&par_add_Bug))),par_WriteCard_InOut._n=(0),_WriteCard_InOut(&par_WriteCard_InOut));

David Egan Evans <sinuhe>
Group administrator
Mon 22 Dec 2014 01:32:50 AM UTC, comment #5: 

This returns 1200:

InOut.WriteInt(add(11, add(100, 1000)), 0);

This returns 1111:

InOut.WriteInt(add(add(1, 10), 1100), 0);

David Egan Evans <sinuhe>
Group administrator
Fri 14 Nov 2014 06:49:57 PM UTC, comment #4: 

Thanks and sorry. My mistake.

I used the search box to the left of the screen and it had/has an option "bugs", which, as it turns out, is global, not project specific.

The Free Software Foundation seems to do a very remarkable and important job, but I think that sometimes they should pay more attention to the quality of their products. May be the approach "less, but better" might help them.

I'll try to resubmit the flaw report to the Octave flaw-track.

Thanks again for Your helpful comment. :-)

Martin Vahi <martin_vahi>
Fri 14 Nov 2014 12:00:45 PM UTC, comment #3: 

Martin, you seem to be talking about a problem with Octave. You're reporting it in the wrong place, this project is about m2c, a Modula-2 compiler. For instructions on reporting on Octave, see https://www.gnu.org/software/octave/bugs.html .

Peter De Wachter <pdewacht>
Thu 13 Nov 2014 10:07:00 PM UTC, comment #2: 

Sorry, the mark-up collided with the code in my previous comment. Hopefully this is a bit better:

---restatement--start----
May be it's a different flaw, but the plotting of

    y=sin(x)+sin(x+4 * sin(x))
   
works and the plotting of

    y=sin(x)+sin(x Y 4 * sin(x))
   
where the Y is a star, id est multiplication,
did not work.
---restatement--end------

Martin Vahi <martin_vahi>
Thu 13 Nov 2014 10:03:01 PM UTC, comment #1: 

May be it's a different flaw, but the plotting of

    y=sin(x)+sin(x+4*sin(x))
   
works and the plotting of

    y=sin(x)+sin(x*4*sin(x))
   
does not work.

---verbatim--start----
octave:7> x=-10:0.1:10;
octave:8> plot(x,sin(x)+sin(x+4*sin(x)));
octave:9> plot(x,sin(x)+sin(x*4*sin(x)));
error: operator *: nonconformant arguments (op1 is 1x201, op2 is 1x201)
error: evaluating argument list element number 1
error: evaluating argument list element number 2
octave:9>
---verbatim--end------

Anonymous
Tue 23 Sep 2014 11:21:53 PM UTC, original submission:  

Consider the program below. It should output "1111", but the actual output is "1200". This is related to, but not the same as, Debian bug #168588.

MODULE Bug;
IMPORT InOut;

PROCEDURE add(i, j: INTEGER): INTEGER;
BEGIN RETURN i + j
END add;

BEGIN
  InOut.WriteInt(add(add(1, 10), add(100, 1000)), 0);
  InOut.WriteLn;
END Bug.

Peter De Wachter <pdewacht>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by sinuhe (Posted a comment)
  • -email is unavailable- added by pdewacht (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-30 sinuhe Carbon-CopyRemoved 97442 -
    2015-04-30 sinuhe StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code