Is FreeBasic still continued to develop?

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Hmm, can't take address of a func result that isn't a reference...
SARG
Posts: 1767
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

And ???
Sry but I don't understand :-)
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Oh sorry, I'm just mumbling ;)

Basically, the emitted C is breaking because it's trying to take the address of a returned value from a function. You can only do that (afaik) if the returned value is a reference. So we see here:

Code: Select all

	#define vr$36 ((VECTOR2D)(_ZplR8VECTOR2DS0_( vr$35, vr$34 )))
	#define vr$37 ((VECTOR2D*)(&vr$36))
	#define vr$38 ((string*)(_ZN8VECTOR2Dcv8FBSTRINGEv( vr$37 )))
	fb_PrintString( (integer)0, vr$38, (integer)1 );
36 is calling your operator+, and 37 is trying to take the address of 36, but 36 is a function result. '&' is the 'take address' operator in C, like @ in FB. So that's why it says "invalid lvalue in unary `&' ", is because the 'lvalue' is a function result.

I'm not sure how to fix it, because if we create a temp var and assign it, then operator= gets called... I'm not sure if this is the correct behavior.

Edit: Actually it looks like that's what TMP$8$ may be for, as it's currently unused in the code. It just isn't hooked up, apparently.
SARG
Posts: 1767
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

cha0s wrote:Oh sorry, I'm just mumbling ;)
No problem, ;-) Your last post is clear.

To test Fbdebugger I use a "twisted" program so I guess that's also a good test for the gcc emitter. To go forward I'm going to put in comment the faulty line.
ok, no other problem.

What about a dedicated topic at the gcc emitter issues ?
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

SARG wrote:What about a dedicated topic at the gcc emitter issues ?
It's probably just better to create topics in General for them.
Post Reply