This is the mail archive of the
mailing list for the GCC project.
Re: Fwd: sub-optimal code for packed boolean arrays in Ada -- bug or inherent limitation
- From: Robert Dewar <dewar at adacore dot com>
- To: Alinabi <alexander dot the dot average at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 02 Jul 2007 17:58:46 -0400
- Subject: Re: Fwd: sub-optimal code for packed boolean arrays in Ada -- bug or inherent limitation
- References: <firstname.lastname@example.org> <email@example.com>
Subject: sub-optimal code for packed boolean arrays in Ada -- bug or
Certainly not a bug, the code generated is correct, it is just not
optimal. Surely it could be fixed if someone had the energy to do so.
I see no particular gain in filing a bug report, it is unlikely this
will cause someone else to jump into action to improve the code in this
The most effective way to get something done here would be for you
to investigate how this could be improved, the relevant unit in the
compiler is exp_pakd.adb. Feel free to ask if you have questions
on the internals of this unit.
pragma Inline_Always(Set, Clear, Flip, Is_Set);
pragma Inline is usually a better choice when using gcc, Inline_ALways
is there primarily for non-gcc targets, and its use with gcc is
I don't know much (if anything) about compiler internals, so I was
wondering if I should file a bug report. Is there some good
theoretical justification for all those extraneous shifts and
No, there is no theoretical justification, just a case of non-optimal
I would think that if the compiler can figure out the best
way to set or clear a bit in a register using shift and logical ops,
than it should also be able to negate it efficiently.
Most certainly it could, it just does not happen to optimize this