Differences in building with gcc 3.4.6 versus gcc 4.4.0 ? - General Discussion and Assistance - CHDK Forum  

Differences in building with gcc 3.4.6 versus gcc 4.4.0 ?

  • 33 Replies
  • 24341 Views
Differences in building with gcc 3.4.6 versus gcc 4.4.0 ?
« on: 23 / April / 2011, 09:49:20 »
Advertisements
Has anyone else experience the situation where CHDK built with gcc 3.4.6 crashes but building with gcc 4.4.0 works ?  

I'm using CHDK-shell to build trunk 1150 for the SD940. If I build with 3.4.6 then file browsing on the camera locks up CHDK although regular camera functions continue to work.  Rebuild with 4.4.0 and everything work properly again. I assume the autobuild server uses 4.4.0  because the download from there works too.
 
All that I can think is that this is telling me I have an address wrong in stub_entry_2.S and the difference in compilers causes different side effects ?  This did not appear to be a problem in earlier trunk versions - I've been using 3.4.6 for the last 8 months.  Maybe I'll try rolling back the clock to see if I can find anything that changed.

« Last Edit: 23 / April / 2011, 15:50:42 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Differences in building with gcc 3.46 versus gcc 4.4.0 ?
« Reply #1 on: 23 / April / 2011, 10:48:13 »
Hi waterwingz,

IIRC, the assembler in GCC 4.4.0+ supports certain ARM assembler syntax that GCC 3.46 does not.
Also, the linker performs stricter checking. Generally, 3.4.6 has more of a tendency to try and
fix stuff instead of warn, so try setting OPT_WARNINGS in compile options, that might give
you more of an idea what's going on, especially since you know in what code it crashes

HTH,

wim



Re: Differences in building with gcc 3.46 versus gcc 4.4.0 ?
« Reply #2 on: 23 / April / 2011, 10:49:16 »
why not just use the latest version of the compiler?

what is the difference between them?
sx20is 1.02d

Re: Differences in building with gcc 3.46 versus gcc 4.4.0 ?
« Reply #3 on: 23 / April / 2011, 12:22:28 »
why not just use the latest version of the compiler?

what is the difference between them?

I've noticed that gcc3 tends to build faster.  Regardless,  CHDK should not crash just because you use a different compiler version.  There is a clue in there somewhere.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14079
Re: Differences in building with gcc 3.46 versus gcc 4.4.0 ?
« Reply #4 on: 23 / April / 2011, 14:53:35 »
why not just use the latest version of the compiler?

what is the difference between them?
If changing compilers causes a crash, it is almost always an indication of some underlying bug in the code.

@waterwingz:
If you can find where it crashes and examine the disassembly in each case, that may give you some clues.

Also brings to mind: http://chdk.setepontos.com/index.php?topic=650.msg64898#msg64898
Don't forget what the H stands for.

Re: Differences in building with gcc 3.46 versus gcc 4.4.0 ?
« Reply #5 on: 23 / April / 2011, 15:15:39 »
If changing compilers causes a crash, it is almost always an indication of some underlying bug in the code.
That's pretty much what I've been assuming.

Also brings to mind: http://chdk.setepontos.com/index.php?topic=650.msg64898#msg64898
Been doing a binary search through old svn versions (painful downloads ... )  and I'm now at the point where 1143 works and 1145 crashes.   Guess where the link you posted here also points?

Stay tuned ...

UPDATE : the patch applied for 1144 appears to break the file browser if you compile with gcc3.  Not sure why but that one small change appears fatal at this point.

UPDATE 2:   Took the patch out and 1144 works.  My C might be rusty but what does the patch do ?
 
Code: [Select]
static char de[40] = "";
Looks like he is trying to create a buffer of 40 characters initialized to be empty.  But I'm thinking what it does is create a pointer (array name) to a string of length 1 (  "" ) rather than a 40 character string with a null in the first byte ?





« Last Edit: 23 / April / 2011, 15:47:08 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: Differences in building with gcc 3.4.6 versus gcc 4.4.0 ?
« Reply #6 on: 23 / April / 2011, 16:10:08 »
Been doing a binary search through old svn versions (painful downloads ... )  and I'm now at the point where 1143 works and 1145 crashes.   Guess where the link you posted here also points?
I hope you are using SVN switch!
Quote
Code: [Select]
static char de[40] = "";
Looks like he is trying to create a buffer of 40 characters initialized to be empty.  But I'm thinking what it does is create a pointer (array name) to a string of length 1 (  "" ) rather than a 40 character string with a null in the first byte ?
Time to get rid of that whole stupid thing instead of worrying about what it's trying to do ;)
Don't forget what the H stands for.

Re: Differences in building with gcc 3.4.6 versus gcc 4.4.0 ?
« Reply #7 on: 23 / April / 2011, 16:18:56 »
I hope you are using SVN switch!
Brute force here  - using TortoiseSVN to checkout different trunk versions and then copying them over to where CHDK-shell expects to find them.  Figuring out how to download just the trunk and not the branches and tags folders cut the download down to 10 minutes or so.   The copy process to the CHDK-shell is more than 5 minutes - tried to use shortcuts but they really don't seem to work as well as symlinks in linux.

Quote
Time to get rid of that whole stupid thing instead of worrying about what it's trying to do ;)

Kind of seems like :
Code: [Select]
static char de[40] ;
de[0]=0x00;
should work on every C compiler ever invented ?



Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14079
Re: Differences in building with gcc 3.4.6 versus gcc 4.4.0 ?
« Reply #8 on: 23 / April / 2011, 16:34:55 »
Brute force here  - using TortoiseSVN to checkout different trunk versions and then copying them over to where CHDK-shell expects to find them.  Figuring out how to download just the trunk and not the branches and tags folders cut the download down to 10 minutes or so.
OK, here's a tip for the future: Right click on your working copy, "TortoiseSVN" -> "switch" -> "Show log". Click on the revision you want. Then it just downloads the *differences* required to change your working copy to that revision. When you are done, just do the same thing and switch back to head. You can switch between branches that way too.

Quote
Kind of seems like :
Code: [Select]
static char de[40] ;
de[0]=0x00;

You'd think so. Or hey, just for paranoia sake memset(de,0,sizeof(de)); Note that the old one would only initialize it the first time through.

I wonder if de needs to be bigger on recent dryos cams, you should be able to find out by making it bigger, setting the remaining bytes to an identifiable values, and checking after the call.

Note also that our dryos readdir uses a single static dirent, which is not correct: http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir.html
Quote
The pointer returned by readdir() points to data which may be overwritten by another call to readdir() on the same directory stream. This data is not overwritten by another call to readdir() on a different directory stream.
I don't think any of our code relies on having multiple dirs open at the same time.

edit:
Oh wait, we do in gui_fselect.c for raw purge at least. No wonder people complained about raw purge being broken... Joy  ::)
« Last Edit: 23 / April / 2011, 16:40:14 by reyalp »
Don't forget what the H stands for.

Re: Differences in building with gcc 3.4.6 versus gcc 4.4.0 ?
« Reply #9 on: 23 / April / 2011, 16:47:37 »
OK, here's a tip for the future: Right click on your working copy, "TortoiseSVN" -> "switch" -> "Show log". Click on the revision you want. Then it just downloads the *differences* required to change your working copy to that revision. When you are done, just do the same thing and switch back to head. You can switch between branches that way too.
So that's what the "switch" choice in the menu does.  Sweet - thanks!  Editorial comment - funny how you get more help online once you make a little effort to figure stuff out for yourself. 8)  Learning curve for CHDK development is steep - I could now do everything it took me three months to figure out in just a day or so.  And I didn't exactly come into this without a little s/w experience.

I wonder if de needs to be bigger on recent dryos cams, you should be able to find out by making it bigger, setting the remaining bytes to an identifiable values, and checking after the call.
Strange thing is that philmoz specially said that the gcc4 compiler barfed without his changes.  Making a buffer bigger never hurts but you would not think it would be compiler specific.

Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics