This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: String packing
- To: Frank Klemm <pfk at fuchs dot offl dot uni-jena dot de>
- Subject: Re: String packing
- From: Andi Kleen <ak at suse dot de>
- Date: 26 Aug 2001 08:01:55 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <20010825205122.A14018@fuchs.offl.uni-jena.de.suse.lists.egcs>
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