This is the mail archive of the
mailing list for the GCC project.
Re: Problems with pragma and attribute optimize.
On Wednesday 25 July 2012, Richard Guenther wrote:
> On Wed, Jul 25, 2012 at 2:23 PM, Allan Sandfeld Jensen
> <firstname.lastname@example.org> wrote:
> > Hi,
> > I have been experimenting with marking specific functions to be auto-
> > vectorized in GCC, but have had problems getting it to work.
> > It seems the optimize attribute works sometimes, but only if the function
> > it is used on is not static, but pragma optimize never seems to work.
> > See the attached test-case. If you compile it with
> > -ftree-vectorizer-verbose, you will see that only the first function is
> > vectorized, but the two last are not.
> > Anyone know what is wrong here?
> The attribute doesn't work in the face of inlining and generally was
> designed for debugging, not for controlling things like you do.
In that case the GCC manual should probably be updated to reflect that. If
what you say it true, it seems it has been developed for one purpose but then
documented for another. (The documentation needs updating anyway, since the
attribute is no longer allowed after the function declaration like all the
examples does, but only before).
I found the problem with pragma though, it is apparently a long standing bug
in PR 48026 and a related version in PR 41201. The last bug actually has a
patch for the problem, it is apparently caused by an incorrect short-cut.