Ticket #137 (closed patch: fixed)

Opened 6 years ago

Last modified 6 years ago

new $P0, ['Integer'] doesn't work in pir

Reported by: cotto Owned by: whiteknight
Priority: normal Milestone:
Component: imcc Version: trunk
Severity: medium Keywords:
Cc: Language:
Patch status: new Platform: all

Description

The following code doesn't work in pir, even though all 4 lines should do the same thing.

.sub main
  new $P0, ['Integer']  #syntax error
  new $P0, 'Integer'    #works fine
  $P0 = new ['Integer'] #works fine
  $P0 = new 'Integer'   #works fine
.end

Attachments

imcc_fix_new_syntax.patch Download (2.4 KB) - added by whiteknight 6 years ago.
patch to fix the problem

Change History

Changed 6 years ago by whiteknight

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

That form definitely doesn't appear in compilers/imcc/imcc.y:1723-1781, where it would have to be. We could definitely add this, I think, without causing any major problems.

I'll hack together a patch today and see what happens.

Changed 6 years ago by coke

I wonder if we could remove the special syntax for new here and just have the assignment syntax for opcodes handle this.

Changed 6 years ago by whiteknight

I was sort of wondering about that myself. I'll play with that a little bit too, and see if it works.

Changed 6 years ago by whiteknight

patch to fix the problem

Changed 6 years ago by whiteknight

  • type changed from bug to patch
  • patch set to new

Okay, I've added a patch here that appears to resolve the problem by removing the special cases with the new keyword and relying on IMCC's normal op syntax magic. I tested it with this code, and the build seems to complete like normal. I tried to test it with some PASM examples, but my PASM-foo is too weak to give it a comprehensive workout.

I'm running through the testsuite now. If I don't find any problems and if there are no objections, I'm going to apply this later.

Changed 6 years ago by whiteknight

  • status changed from assigned to closed
  • resolution set to fixed

This should be fixed in r35353. I didn't remove all the special cases of the 'new' keyword, because removing the last one causes a few errors in the test suite. eventually I would like to remove the last one, but it's not critical now.

resolved.

Note: See TracTickets for help on using tickets.