Ticket #1517 (closed bug: fixed)

Opened 12 years ago

Last modified 12 years ago

Comparing Rational PMC to Integer PMC with == blows up

Reported by: dukeleto Owned by: coke
Priority: normal Milestone:
Component: core Version: 2.2.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform: all

Description

parrot_shell 1> loadlib $P1, 'rational'
    new $P2, 'Rational'
    new $P3, 'Integer'
    $P2 = "2/1"
    $P3 = 2
    if $P2 == $P3 goto pass
    ok(0,'== on Rational and Integer PMC')
    .return()
  pass:
    ok(1,'== on Rational and Integer PMC')

.
sh: line 1: 15416 Bus error               ./parrot /var/folders/B3/B3qJ-edQFWKuziEWXxoYbU+++TI/-Tmp-/pi9VLNZE7y > /var/folders/B3/B3qJ-edQFWKuziEWXxoYbU+++TI/-Tmp-/IXPYvruA5j 2>&1
Error: child exited with value 138
Time: 2.03318 wallclock secs 

Change History

Changed 12 years ago by coke

  • status changed from new to assigned
  • owner set to coke

Changed 12 years ago by coke

This patch should fix the issue; looks like a temporary Rat was created for the comparison, but then a non-existent attribute on the Integer was used instead.

Index: src/dynpmc/rational.pmc
===================================================================
--- src/dynpmc/rational.pmc     (revision 45011)
+++ src/dynpmc/rational.pmc     (working copy)
@@ -1028,7 +1028,7 @@
         mpq_init(t);
         mpq_set_ui(t, VTABLE_get_integer(INTERP, value), 1);

-        eq = (INTVAL) mpq_equal(RT(SELF), RT(value));
+        eq = (INTVAL) mpq_equal(RT(SELF), t);
         mpq_clear(t);

         return eq;

Changed 12 years ago by coke

Committed in r45291.

Changed 12 years ago by coke

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.