Is FreeBasic still continued to develop?

For other topics related to the FreeBASIC project or its community.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Feb 10, 2010 11:46

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

Postby SARG » Feb 10, 2010 12:50

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

Postby cha0s » Feb 10, 2010 13:08

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: 1143
Joined: May 27, 2005 7:15
Location: FRANCE

Postby SARG » Feb 10, 2010 13:33

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: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Feb 10, 2010 13:55

SARG wrote:What about a dedicated topic at the gcc emitter issues ?


It's probably just better to create topics in General for them.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests