Skip to content

Nested array returns cause bad memory/invalid instructions #293

Open
@Southclaws

Description

@Southclaws

Is this a BUG REPORT, FEATURE REQUEST or QUESTION?:

  • Bug Report
  • Feature Request
  • Question

What happened:

Returning an array into another return into the arguments of another function result in a runtime crash.

What you expected to happen:

No runtime crash, I expect to nest functions in arguments any number of times with no issues.

How to reproduce it (as minimally and precisely as possible):

With: https://github.com/sampctl/pawn-array-return-bug

sampctl get sampctl/pawn-array-return-bug
cd pawn-array-return-bug
sampctl package run --forceBuild

Anything else we need to know?:

I'm not entirely sure if this is something that can be fixed via the compiler but from my limited knowledge, I think it could be fixed.

People run into this a lot when they cut corners by writing a GetPlayerName wrapper that returns the name instead of writing it into a pass-by-reference. I often advise people to avoid doing this, but it still seems like something that should be fixed if it can be.

Environment:

  • Operating System: All
  • Compiler version: 3.10.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions