Compiler assertion: passing args: byref should not clone into temps

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
pemo18
Posts: 76
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

Compiler assertion: passing args: byref should not clone into temps

Post by pemo18 »

Hello X#-Compiler team,

I am working on a large x# project and recently I get a dozens of compiler assertions that do not make sense to me.

The projects gets compiled but I have to click on a dozens dialog boxes every time (system beep included).

The assert message is : passing args: byref should not clone into temps

Is this due to my code or a bug in the compiler?

Regards,
Peter
Attachments
XharpCompilerAssert_0104.jpg
XharpCompilerAssert_0104.jpg (117.13 KiB) Viewed 299 times
User avatar
robert
Posts: 4290
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Compiler assertion: passing args: byref should not clone into temps

Post by robert »

Peter,
I guess you are using the public build 2.0.0.8 (it is a good idea to include this info in a message):
public builds include the debug version of the compiler which has assertions enabled.
What you see is an assertion message.
I think you are passing a literal value to a function or method that expects a variable by reference. The compiler then has to create a temporary variable and pass its address by reference. The roslyn developers have created an assertion for this.
If you send us your code we can tell you exactly where the problem is and then we can most likely create a better error or warning for this.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
pemo18
Posts: 76
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

Compiler assertion: passing args: byref should not clone into temps

Post by pemo18 »

Hello Robert,

Sorry, I forgot the most important piece of information - I am using version 2.0.8.

I cannot provide the source code because right now I have no idea which method or function cause the assertion. And I am not using any ref parameter explicitly.

Are there any compiler log files may be?

Another issue is that some projects compile with 0 errors and 0 warnings but with a "Fehler" without any details about the error.

Kind regards (and thank you for taking your time for this minor issue)
,
Peter
User avatar
robert
Posts: 4290
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Compiler assertion: passing args: byref should not clone into temps

Post by robert »

Peter
> Another issue is that some projects compile with 0 errors and 0 warnings but with a "Fehler" without any details about the error.
This maybe caused by the same problem.
Without seeing your source I can't really say what causes this. If you are allowed to then please zip all the source and mail it to me or Chris. If you want us to sign an NDA first then that's fine.
I am sure that WITH the source we'll find the cause of the problems very quickly. Otherwise it will be virtually impossible.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4599
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiler assertion: passing args: byref should not clone into temps

Post by Chris »

Peter,

This is a small sample code that was producing this assertion dialog in build 2.0.8:

Code: Select all

	LOCAL n AS INT
	Default(@n , 123) // assertion dialog here
This is now fixed in 2.0.9, there's a proper error message that the first param to Default() must be a USUAL, not an INT.

Maybe you can check your code about such incorrect calls to Default(), or any other function/method that requires a usual by reference. If not, as Robert said, only way to find the problem is for you to send up the code to have a look.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
pemo18
Posts: 76
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

Compiler assertion: passing args: byref should not clone into temps

Post by pemo18 »

Hello Chris,

I just want to inform you that the compiler assertions error message still persists - in the meantime I have to click away > 100 error messageboxes for each compile! But this happens only on one machine (otherwise I would have given up;). Not on others. But since this my developer pc I wish there would be some way to avoid getting all the error messages.

I have to stick with Bandol 2.0.8 for the moment until the final version will be avaliable.

Kind regards,
Peter

PS: I was not able to make the small sample code you have included to compile. Something was missing.
User avatar
Chris
Posts: 4599
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiler assertion: passing args: byref should not clone into temps

Post by Chris »

Hi Peter,

It's only "debug" builds (distributed with the public X# versions) that show those dialogs (unintentionally), please install X# with the installer found in the subscribers download area and you will not get the messages any more.

The sample was not meant to compile, this is indeed not allowed:

FUNCTION Start() AS VOID
LOCAL n AS INT
Default(@n , 123) // error cannot convert INT to USUAL

Default() only works with USUAL vars by design, so if you are using non-USUALS in it, then you need to adjust the code.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
pemo18
Posts: 76
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

Compiler assertion: passing args: byref should not clone into temps

Post by pemo18 »

Hello Chris,

I was not aware that I was using a debug build. I re-installed the X#-Sharp Compiler and no more dialogboxes:)

Thank you for your help,
https://www.xsharp.eu/forum/public-prod ... reply/9208
Peter
Post Reply