This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: String packing


Frank Klemm <pfk@fuchs.offl.uni-jena.de> writes:

> How to avoid the silly string alignment:
> 
> char  string1 [] = "Hello";
> char  string2 [] = "world";
> 
> Hex dump of the binary:
> 
> 	H e l l o . . . . . . . . . . .
> 	. . . . . . . . . . . . . . . . 
> 	w o r l d . . . . . . . . . . .
> 	. . . . . . . . . . . . . . . . 


I just tried your example with gcc 2.95.3, gcc 3.0.0 and a recent gcc 3.1 
development snapshot with binutils 2.9.5.0.24 on linux and all generate
perfect packing for your example. If it isn't the case on your box 
I would more suspect the binutils than the compiler.

> On the Pentium 4 the fastest code I often get with '-Os', I have some examples
> where '-O3' generates code with 40% of the performance than the '-Os' code.

If you have test cases that show such a  problem on gcc 3.1 I'm sure they would
be welcome.


-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]