[Bug 780551] Re: incorrect interface in avxintrin.h

Andrew Stubbs 780551 at bugs.launchpad.net
Wed May 25 11:47:53 UTC 2011


I'm very nervous about adding anything that allows you to tell which
distro/vendor/whatever a compiler came from.

Yes, there are applications where a careful user could use that
information, but the problem is that other people would use that macro
incorrectly, and before you know it you have entire packages that are
silently depending on these things. Then one day, Ubuntu ceases to use
Linaro compilers, and suddenly dozens of packages stop building for no
known reason, and all their dependencies also fail to build/install, and
it's the compiler team that gets the blame.

And, of course, you also gets sources that won't build on other distros,
etc.

The correct way to handle this is to add a macro per-feature that tells
you what form to use. Unfortunately, this really has to be done at the
time of the interface changes, or else you still have versions you don't
know what to do with.

I think that in this case, given that natty gcc is frozen and won't get
upgraded to 4.5.3, we should add a small patch which defines a macro
_MM_MASKSTORE_PS_NEEDS_NATTY_WORKAROUND. This will only ever exist in
natty gcc, and therefore very few people will ever know it exists, and
even fewer will have any interest in using it, so nothing will break
later.

You code would then be:

__m128 m, x;
float *mem;
#if !defined(_MM_MASKSTORE_PS_NEEDS_NATTY_WORKAROUND) && defined(__GNUC__) && __GNUC__ == 4 && (__GNUC_MINOR__ < 5 || (__GNUC_MINOR__ == 5 && __GNUC_PATCHLEVEL__ <= 2))
_mm_maskstore_ps(mem, m, x);
#else
_mm_maskstore_ps(mem, _mm_castps_si128(m), x);
#endif

You'd have to carry this slight nonsense in your source for while, but
it won't do any harm even if you kept it forever.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.5 in Ubuntu.
https://bugs.launchpad.net/bugs/780551

Title:
  incorrect interface in avxintrin.h

Status in Linaro GCC:
  New
Status in “gcc-4.5” package in Ubuntu:
  Won't Fix

Bug description:
  Binary package hint: gcc-4.5

  The following code compiles with vanilla GCC:
  __m128 m, x;
  float *mem;
  #if defined(__GNUC__) && __GNUC__ == 4 && (__GNUC_MINOR__ < 5 || (__GNUC_MINOR__ == 5 && __GNUC_PATCHLEVEL__ <= 2))
  _mm_maskstore_ps(mem, m, x);
  #else
  _mm_maskstore_ps(mem, _mm_castps_si128(m), x);
  #endif

  It fails to compile on Ubuntu because the interface of _mm_maskstore_ps was changed to the interface of GCC 4.5.3, but the version number was kept at 4.5.2.
  Which macro does Ubuntu GCC provide to check for this?

  For what it's worth, I believe this patch should be reverted in the
  GCC package, though it's probably too late already. I'd hope the
  updates to the gcc package would be good enough, though. Or consider
  to upgrade to 4.5.3 completely.

  Also, just to add a bit of perspective: I do nightly builds of a
  software project where GCC snapshots between even patch levels often
  exhibit miscompilations. I don't see how a distribution could sensibly
  take any patches from GCC between releases and release that as a given
  GCC package. A distribution has the means to ensure that its own
  packages compile, but that it executes correctly...? In this case you
  broke source compatibility without any means to distinguish the
  interface version. Since it only affects development for AVX it is no
  wonder that you don't notice. That hopefully doesn't imply that you
  don't care...

  ProblemType: Bug
  DistroRelease: Ubuntu 11.04
  Package: gcc 4:4.5.2-1ubuntu3
  ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
  Uname: Linux 2.6.38-8-generic x86_64
  NonfreeKernelModules: nvidia
  Architecture: amd64
  Date: Tue May 10 16:13:13 2011
  InstallationMedia: Kubuntu 11.04 "Natty Narwhal" - Release amd64 (20110426.3)
  ProcEnviron:
   LANGUAGE=en_US:en
   PATH=(custom, user)
   LANG=en_US.UTF-8
   SHELL=/bin/zsh
  SourcePackage: gcc-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)




More information about the foundations-bugs mailing list