compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Fix return array size specifications being ignored in operator declarations

Open Daniel-Cortez opened this issue 2 years ago • 5 comments

What this PR does / why we need it:

Fixes return array size specifications being silently ignored in new-style operator declarations (see #685) and makes the compiler treat such specifications as errors.

Which issue(s) this PR fixes:

Fixes #685

What kind of pull this is:

  • [x] A Bug Fix
  • [ ] A New Feature
  • [ ] Some repository meta (documentation, etc)
  • [ ] Other

Additional Documentation:

Daniel-Cortez avatar Oct 09 '21 15:10 Daniel-Cortez

This issue has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Jan 09 '22 02:01 stale[bot]

@Daniel-Cortez Just to tell you (don't know a better way to contact you), I'm going to go through the backlog this week and try release 3.10.11 on 08/02, since it is exactly 2 years since 3.10.10. Seems appropriate.

Y-Less avatar Feb 02 '22 10:02 Y-Less

Did you mean 3.11? 3.10.11 just seems kind of wrong to me...

DEntis-T avatar Feb 22 '22 11:02 DEntis-T

@DEntis-T: No

@Daniel-Cortez:

1>Running gh_685... FAILED
1>Test gh_685 failed for the following reason: Error output didn't match
1>
1>Expected errors:
1>
1>gh_685.pwn(1): error 010: invalid function or declaration
1>gh_685.pwn(2): error 010: invalid function or declaration
1>
1>Actual errors:
1>
1>gh_685.pwn(1): error 010: invalid function or declaration
1>gh_685.pwn(2): error 010: invalid function or declaration
1>Assertion failed: parent_sym->ident==iREFARRAY, file C:\Users\Alex\Documents\SA-MP\pawn\source\compiler\sc2.c, line 3229
1>

Which is:

    case iREFARRAY:
      /* a global iREFARRAY symbol is the return value of a function: delete
       * this only if "globals" must be deleted; other iREFARRAY instances
       * (locals) are also deleted
       */
      mustdelete=(sym->vclass==sGLOBAL) ? delete_functions : TRUE;
      for (parent_sym=sym->parent; parent_sym!=NULL && parent_sym->ident!=iFUNCTN; parent_sym=parent_sym->parent)
        assert(parent_sym->ident==iREFARRAY);
      assert(parent_sym==NULL || (parent_sym->ident==iFUNCTN && parent_sym->parent==NULL));
      if (sym->vclass==sGLOBAL) {
        assert(parent_sym!=NULL && parent_sym->ident==iFUNCTN);
        if ((parent_sym->usage & uNATIVE)!=0) {
          /* native functions aren't preserved (see the comment under the
           * 'iFUNCTN' case below), so the array must be deleted as well */
          mustdelete=TRUE;
        } /* if */
      } /* if */
      break;
        assert(parent_sym->ident==iREFARRAY);

Y-Less avatar Mar 08 '22 11:03 Y-Less

@Daniel-Cortez Just to tell you (don't know a better way to contact you), I'm going to go through the backlog this week and try release 3.10.11 on 08/02, since it is exactly 2 years since 3.10.10. Seems appropriate.

@Y-Less Well, I tried to contact you via Discord, sent you a friend request a few months ago, but you didn't answer. Anyway, is https://github.com/openmultiplayer/compiler the actual repo for the compiler now? If so, should I move my PRs there?

Daniel-Cortez avatar Jul 31 '22 13:07 Daniel-Cortez