ffweb
New Member
Posts: 20
|
Post by ffweb on Sept 25, 2010 22:21:37 GMT 1
When I try to send optimization option to gcc, like in the following command:
bacon -o -O2 xxx.bac
I get this error:
Starting conversion... done. Starting compilation... Compiler emits messages! Error opening file: Bad address
I use Ubuntu 10.04 64 bits.
|
|
|
Post by Pjot on Sept 26, 2010 9:24:56 GMT 1
This is caused by the fact that the optimization cannot handle some code in the default header file emitted by BaCon. Note that the whole error reporting was designed to catch errors in user code. Hence any warnings emitted by GCC related to code generated by BaCon before any conversion takes place will not be shown; it is simply out of scope. Technically, this is not even a bug, as the error reporting should not have to show problems in the default C code Nevertheless it was extremely easy to fix, can you re-download and try again? Thanks, Peter
|
|
ffweb
New Member
Posts: 20
|
Post by ffweb on Sept 26, 2010 21:17:36 GMT 1
Hi,
Now I get the following:
Starting conversion... done. Starting compilation... Compiler emits messages! /home/francesco/bin/bacon.bash: line 4729: $g_FEED: ambiguous redirect
|
|
|
Post by Pjot on Sept 26, 2010 22:21:37 GMT 1
Can you show me the contents of the logfile? The name of this file is your original BaCon file with '.log' attached.
So if your BaCon file is called "bla.bac", then the logfile is "bla.bac.log".
Thanks, Peter
|
|
ffweb
New Member
Posts: 20
|
Post by ffweb on Sept 28, 2010 19:53:52 GMT 1
Here it is (sorry for the delay)
In file included from ./primesieve.bac.c:2: ./primesieve.bac.h: In function '__b2c__search': ./primesieve.bac.h:248: warning: ignoring return value of 'fread', declared with attribute warn_unused_result ./primesieve.bac.h: In function '__b2c__exec': ./primesieve.bac.h:255: warning: ignoring return value of 'system', declared wit h attribute warn_unused_result In file included from ./primesieve.bac.c:2: ./primesieve.bac.h: In function '__b2c__getxy': ./primesieve.bac.h:284: warning: ignoring return value of 'write', declared with attribute warn_unused_result
|
|
|
Post by Pjot on Sept 28, 2010 21:02:19 GMT 1
Thanks - that looks good. (The code fix was simply to initialize the filename occuring in the logfile to the variable 'g_FEED'.) Therefore your error cannot occur anymore... Did you really download the latest BaCon (not accidentally older version from your browser cache or from some proxy server cache)? The bytesize of bacon.bash should be: 175377 The MD5SUM of bacon.bash is: 99367b058fc8ed6539ed322e2cfcb850 Can you crosscheck this with the version you are using...? Thanks, Peter PS: as you can see, only warnings are emitted and your binary will be generated if you use the '-O2' flag.
|
|
ffweb
New Member
Posts: 20
|
Post by ffweb on Sept 29, 2010 21:24:05 GMT 1
You're right. Updating bacon.bash (I was sure to be updated...) the executable is produced correctly. The only annoying thinks are that generated .c and .h files aren't automatically deleted (that's easy to do by hand, however) and the following message appears in the terminal:
Problem: file './XXX.bac.h' line 248: fread(__b2c__ptr, sizeof(char), strlen(__b2c__y), __b2c__x);__b2c__off+=1; Cause: ignoring return value of 'fread', declared with attribute warn_unused_result
Thank you.
|
|
|
Post by Pjot on Sept 30, 2010 7:29:39 GMT 1
When there are problems then the generated files remain on disk. This was a previous request of other BaCon users ....guess we can't make everybody happy. Now the warning you see occurs only because of the -O2 optimization. I see the same warning(s) on my side but these are harmless. As mentioned, this relates to the generic code emitted by BaCon; it seems GCC wants to be able to return a value to a variable in case 'fread' is used, despite the fact that the BaCon code does not need this returnvalue. In the next release I will make sure these are gone. BR, Peter
|
|
|
Post by Pjot on Oct 3, 2010 9:59:43 GMT 1
Hi ffweb, So it is fixed, can you download the latest from the BETA directory and let me know if it solves the problem for you? Thanks, Peter
|
|
ffweb
New Member
Posts: 20
|
Post by ffweb on Oct 3, 2010 16:16:52 GMT 1
Hi Pjot
It works fine now. Bacon generates the executable, with the optimization options, without warning or other issues.
Now, instead of strip-ing the executable to reduce the size, you can use the '-o -s' option, when compiling with gcc.
Thank you for such a quick solution.
|
|