Where can I get a Recent-Git-Build of FreeBASIC?

For other topics related to the FreeBASIC project or its community.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Postby AGS » Apr 19, 2012 21:59

I am having trouble coming up with a small example. The error occurs in source code with a length of (about) 9000 lines. I tried to get a minimal example but the compiler only chokes when using the full 9000 lines of code. I get only one error.

A link to the source code (all 8836 lines of it):
http://www.sarmardar.nl/FreeBASIC/example.zip

The error message I get:
d:\Projects\fbc24_latest\fbc0.24_windows20120416>.\fbc -gen gcc coco_total.bas
coco_total.c:7536: error: conflicting types for 'GRAPH_CREATE_NODE'
coco_total.c:513: error: previous declaration of 'GRAPH_CREATE_NODE' was here
coco_total.c:7536: error: conflicting types for 'GRAPH_CREATE_NODE'
coco_total.c:513: error: previous declaration of 'GRAPH_CREATE_NODE' was here


And when using -gen gcc -g I get:

d:\Projects\fbc24_latest\fbc0.24_windows20120416>.\fbc -g -gen gcc coco_total.ba
s

d:\Projects\fbc24_latest\fbc0.24_windows20120416>


It's really annoying that I can't come up with a minimal example.
I tried creating an example with
- forward declaration for node_;
- the graph declaration;
- the graph_create_node declaration;
- the graph_create_node implementation followed by;
- the node declaration.

but to no avail. I can only reproduce the error when compiling the example.

A 9000 line file is not exactly a minimal example but it's the best I can do.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby AGS » Apr 19, 2012 22:44

SARG wrote:@AGS
Fbdebugger is compiled without problem (except warnings) with/without the -g option.
By the way, it partially works with the debuggees compiled with the -gen gcc option. But there are still many issues to be resolved. :-(

About your issse, could you test : compile with the -R option (obviously without -g), add a dummy debug line to the c file.
#line 0 "C:\\TEMP\\dev\\testgcc2.bas" just to have at least one data in the debug area
And continue the compilation with the -g option in the gcc.exe command.


The code -gen gcc chokes on is a program that uses lots of forward declarations. I am still somewhat clueless as to why the error occurs. I cannot get a minimal example going and finding a bug in a 9000 line file (=size of example the compiler chokes on) is just plain hard.

Debugging....

I can still see them tmp$ variables pop up left, right and centre in the output. It's going to be hard to get a very good debugging experience with all the renaming/name mangling in the resulting C code. Can't complain too much, though. I'm sure that a couple of releases from now issues can be resolved and the debugging experience is getting better with every release (the code produced by the gcc back end is easier to debug than the code produced by the asm back end when using -gdwarf-2 and not using -fomit-frame-pointer).
SARG
Posts: 911
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby SARG » Apr 23, 2012 14:11

@AGS

Compil with the -R option and no need -g, then in the c file just add "#line 0" before the declaration like that

Code: Select all

GRAPH_* __attribute__((stdcall)) GRAPH_CREATE( void );
#line 0
GRAPH_* __attribute__((stdcall)) GRAPH_CREATE_NODE( NODE_$type* );


Then execute gcc and ld (don't forget to change the directory names)

Code: Select all

c:\TEMP\dev\freebasic\bin\gcc.exe -c -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -finline -ffast-math -fomit-frame-pointer -fno-math-errno -fno-trapping-math -frounding-math -fno-strict-aliasing -O0 -mtune=athlon "C:\TEMP\dev\testagsdebug2.c" -o "C:\TEMP\dev\testags.o"

c:\TEMP\dev\freebasic\bin\ld.exe -o "C:\TEMP\dev\testags.exe" -subsystem console --stack 1048576,1048576 -L "c:\TEMP\dev\freebasic\lib" -L "." "c:\TEMP\dev\freebasic\lib\crt2.o" "c:\TEMP\dev\freebasic\lib\crtbegin.o" "c:\TEMP\dev\freebasic\lib\fbrt0.o" "C:\TEMP\dev\testags.o" "-(" -lfb -lgcc -lmsvcrt -lkernel32 -lmingw32 -lmingwex -lmoldname -lsupc++ -lgcc_eh "-)" "c:\TEMP\dev\freebasic\lib\crtend.o"


And don't ask me why it works ;-). Put comments to separe the lines is not enough.
I have compared the files with/without debug stuff and there is no difference except the pragmas (and comments)
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby MOD » Apr 25, 2012 16:45

And again: new builds uploaded. Lot's of bugs fixed.
fxm
Posts: 9310
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby fxm » Apr 25, 2012 18:02

MOD wrote:And again: new builds uploaded. Lot's of bugs fixed.

Yes, thank you all.
Delete[] of derived type instance => compiler runtime error is now well fixed!
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby Merick » May 01, 2012 0:22

Just tried the new build, fbc crashed, and the crash triggered a security alert from Norton. According to the log, it says that fbc tried to start a remote thread in a process address space.
fxm
Posts: 9310
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby fxm » May 01, 2012 5:04

Until now, no problem for me....

fbc: FreeBASIC Compiler - Version 0.24.0 (04-25-2012) for win32
OS: Windows XP (build 2600, Service Pack 3)
McAfee
dodicat
Posts: 6026
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby dodicat » May 01, 2012 9:03

Downloaded the zip and tried a few programs.
No problem here.
Same set up as fxm for operating system.
Avast anti virus.

FreeBASIC Compiler - Version 0.24.0 (04-25-2012) for win32
Copyright (C) 2004-2012 The FreeBASIC development team.
standalone, objinfo: disabled
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby Merick » May 01, 2012 23:45

Alright, if I turn off norton it seems to work fine
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Postby AGS » May 02, 2012 22:34

Alas, it did not solve the bug related to my 8000+ line program(s) (basically forward declaration problems).

No problem when compiling using the assembler front end. One error when using the gcc back end and the non - OOP version.

Some more errors when I use the OO version of the same program. All errors disappear when using -g (it's a kinda magic :) ).

One error that has to do with declarations might be of importance.

final.c:675: error: conflicting types for 'malloc'
final.c:675: error: conflicting types for 'malloc'


My program includes stdlib.bi and calls the function malloc. malloc is defined like so in stdlib.bi:

declare function malloc (byval as size_t) as any ptr


whereas the C code produced by -gen gcc contains this

void malloc(integer)


In the resulting source code I get this
void* malloc( integer );
//other lines
void* malloc( uinteger );


The first declaration of malloc (integer type argument) was put in by the C back end, the other is from stdlib.bi. Actually the uinteger started out as a size_t which is defined as an alias for uinteger (at least on win32 it is).

According to the C standard the argument to malloc should be size_t. Both on Linux and Windows size_t is defined as an uinteger (unsigned integer) so I am quite sure void* malloc( integer) is wrong. The problem is that the rtlib introduces a malloc with an integer argument. I got the error due to the the use of one call to allocate. If I change that to callocate all is well again as no prototype for malloc is created by the C back end (and the one put in by including stdlib.bi is correct).

Prototypes added to the code by the fb rtlib can conflict with prototypes added by including a file from the crt. If I would have used calls to callocate and calloc the same problem would have occurred (calloc is defined using an argument of type size_t, not integer).

callocate, allocate and reallocate are thin wrappers around calloc, malloc and realloc. If you mix calls to the wrappers with calls to the wrapped functions chances are the code will not compile. Fixing this could be a matter of fixing the types used by the thin wrappers.

size_t is defined the same on linux/windows (unsigned integer) but not on dos (there size_t is defined as an ulong).
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Postby AGS » May 02, 2012 23:46

Tried the new OOP features and got a nice crash.

Code: Select all

type base_

public:
  x as integer

end type

type parent extends base_

  dim y as integer
  declare property x(byval z as integer)
  declare property x as integer

end type

property parent.x(byval z as integer)

  this.x = 44 

end property

property parent.x as integer

  return this.x

end property

dim z as parent
z.x = 44


Compiled using -gen gcc, no errors. But the resulting program crashes. Problem is use of x as name of a property in parent and as a member in base_. Changing the name of property x to something else (anything but x) solves the problem.

Should you post bug reports on errors found in non - official builds of the freebasic compiler? For all I know dkl has not implemented properties yet (at least not properties in types that inherit from some other type) and I found a bug that's merely a non - implemented feature which is going to be part of the next official fbc release?
fxm
Posts: 9310
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby fxm » May 03, 2012 6:18

AGS wrote:Tried the new OOP features and got a nice crash.

AGS wrote:For all I know dkl has not implemented properties yet (at least not properties in types that inherit from some other type) and I found a bug that's merely a non - implemented feature which is going to be part of the next official fbc release?

No compiler bug.
All the bases of OOP are implemented (with just some residual and identified bugs).
We would hope one day to have polymorphism and multiple inheritance!

But your program is wrong!
The property 'x' induces an infinite recursion because inside it, 'this.x' calls the property itself => stack overflow.
If you want address the field 'x' of 'base_', you must use 'base.x' (inside property get and property set).

Code: Select all

type base_

public:
  x as integer

end type

type parent extends base_

  dim y as integer
  declare property x(byval z as integer)
  declare property x as integer

end type

property parent.x(byval z as integer)

  base.x = 44

end property

property parent.x as integer

  return base.x

end property

dim z as parent
z.x = 44
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby AGS » May 04, 2012 21:18

fxm wrote:But your program is wrong!
The property 'x' induces an infinite recursion because inside it, 'this.x' calls the property itself => stack overflow.


RIght you are. Recursion is what I saw in the resulting C code without realising the consequences. My mistake. Thank you for pointing out my mistake.
fxm
Posts: 9310
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby fxm » May 21, 2012 7:52

Thanks for the git-Daily-Builds comeback at http://www.freebasic-portal.de/download ... uilds.html

The comment precises that the Windows version is predisposed for a C-emitter use:
Tipp: Die Windows-Version des FreeBASIC-Daily-Builds enthält bereits alle notwendigen Dateien, um den neuen C-Emitter (-gen gcc) verwenden zu können.
Tip: The Windows version of the Free Basic Daily builds already contains all necessary files to use the new C-emitter (-gen gcc).


But when I try to compile, the file (at least) "libgmp-10.dll" is missing for "cc1.exe"!
Sebastian
Posts: 131
Joined: Jun 18, 2005 14:01
Location: Europe / Germany
Contact:

Re: Where get a Recent-Git-Build of FreeBASIC?

Postby Sebastian » May 21, 2012 18:01

Hey fxm,

Thanks for your posting!
fxm wrote:But when I try to compile, the file (at least) "libgmp-10.dll" is missing for "cc1.exe"!

I've modified the build script in consequence of your helpful hint. A few minutes ago, the system finished uploading a new ZIP package for Windows. I hope it includes all the necessary files now. ;-)

Today is the first day our git daily builds are available on an automated regular basis. :-)

Sebastian

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests