Bug#705583: clang issues a warning for GCC's self-initialization trick

Vincent Lefevre vincent at vinc17.net
Wed Apr 17 08:09:42 UTC 2013


Package: clang
Version: 1:3.0-6.2
Severity: minor

clang issues a warning when GCC's self-initialization trick as
described on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296#c3
is used. This is a bug a clang claims GNUC compatibility. See the
following testcase.

int foo (void);
void bar (int);

void f (void)
{
  int init = 0;
#if defined(__GNUC__)
  int x = x;
#else
  int x;
#endif

  while (1)
    {
      if (init == 0)
        {
          x = foo ();
          init = 2;
        }
      bar (x);
    }
}

Here, GCC's trick is necessary to avoid a warning with GCC. This
is protected with the "#if defined(__GNUC__)". Unfortunately clang
defines __GNUC__ and doesn't support this trick, which has the
effect to issue a warning instead of avoiding one.

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.8-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang depends on:
ii  libc6                2.13-38
ii  libclang-common-dev  1:3.3~svn177638-1
ii  libffi5              3.0.10-3
ii  libgcc1              1:4.7.2-5
ii  libllvm3.0           3.0-10
ii  libstdc++6           4.7.2-5
ii  libstdc++6-4.6-dev   4.6.3-15

Versions of packages clang recommends:
ii  llvm-3.0-dev  3.0-10
ii  python        2.7.3-4

clang suggests no packages.

-- no debconf information



More information about the Pkg-llvm-team mailing list