Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #15958 #15970

Merged
merged 9 commits into from
Nov 20, 2020
Merged

fix #15958 #15970

merged 9 commits into from
Nov 20, 2020

Conversation

cooldome
Copy link
Member

fix #15958

@@ -282,7 +282,7 @@ proc ccgIntroducedPtr(conf: ConfigRef; s: PSym, retType: PType): bool =
result = false
# first parameter and return type is 'lent T'? --> use pass by pointer
if s.position == 0 and retType != nil and retType.kind == tyLent:
result = pt.kind != tyVar
result = pt.kind notin {tyVar, tyArray}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But C arrays are pointers already, why would the C code generator introduce another indirection in this case?

Copy link
Member Author

@cooldome cooldome Nov 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix actually removes double pointer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then what about tyOpenArray, tyVarargs (and maybe tySequence)?

Copy link
Member Author

@cooldome cooldome Nov 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right tyOpenArray, tyVarargs also need this fix. Seq is fine.
Added tests to cover tyOpenArray, tyVarargs to PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, big sets are mapped to C arrays... :-)

Copy link
Member Author

@cooldome cooldome Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are and they need the fix. Added big sets as well :)

@cooldome
Copy link
Member Author

ready for review

@Araq Araq merged commit fcb2ec4 into devel Nov 20, 2020
@Araq Araq deleted the fix_15958 branch November 20, 2020 13:58
narimiran pushed a commit that referenced this pull request Nov 20, 2020
* fix #15958

* also cover openArray and VarArgs

* more tests

* cover even more types

* cover even more types

* Trigger build

* Trigger build

* cover sets passed as arrays

(cherry picked from commit fcb2ec4)
timotheecour added a commit to timotheecour/Nim that referenced this pull request Nov 20, 2020
timotheecour added a commit to timotheecour/Nim that referenced this pull request Nov 20, 2020
cooldome pushed a commit that referenced this pull request Nov 20, 2020
* followup #15970 strenghten regression tests

* _
ringabout pushed a commit to ringabout/Nim that referenced this pull request Nov 25, 2020
mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
* fix nim-lang#15958

* also cover openArray and VarArgs

* more tests

* cover even more types

* cover even more types

* Trigger build

* Trigger build

* cover sets passed as arrays
mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
* fix nim-lang#15958

* also cover openArray and VarArgs

* more tests

* cover even more types

* cover even more types

* Trigger build

* Trigger build

* cover sets passed as arrays
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lent codegen error for c++ (works with c,js,vm)
3 participants