https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84772

            Bug ID: 84772
           Summary: powerpc-spe: Spurious "is used uninitialized" warning,
                    or possibly incorrect codegen for va_arg(long double)
           Product: gcc
           Version: 7.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zackw at panix dot com
  Target Milestone: ---

The following test case is a mechanical reduction from the implementation of
vfprintf in GNU libc:

    extern void *memset(void *, int, __SIZE_TYPE__);
    void f(int *a, __builtin_va_list b)
    {
      memset(a, 2, sizeof(int));
      for (;;)
        __builtin_va_arg(b, long double);
    }

I get a spurious uninitialized value warning on the __builtin_va_arg line with
a powerpc-spe compiler, but not with the exact same build targeting a different
architecture -- not even a different powerpc variant:

$ powerpc-glibc-linux-gnuspe-gcc -S -O -Wall -Werror vfp_min3.c; echo $?
vfp_min3.c: In function ‘f’:
vfp_min3.c:6:25: error: ‘va_arg_tmp.3’ is used uninitialized in this function
[-Werror=uninitialized]
     __builtin_va_arg(b, long double);
     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
cc1: all warnings being treated as errors
1
$ powerpc-glibc-linux-gnu-gcc -S -O -Wall -Werror vfp_min3.c; echo $?
0

$ powerpc-glibc-linux-gnuspe-gcc --version
powerpc-glibc-linux-gnuspe-gcc (GCC) 7.3.1 20180307 [gcc-7-branch revision
258338]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ powerpc-glibc-linux-gnu-gcc --version
powerpc-glibc-linux-gnu-gcc (GCC) 7.3.1 20180307 [gcc-7-branch revision 258338]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This is an extra frustrating spurious-uninitialized bug because it's
complaining about a variable that doesn't even exist in the source code -- I
guess it's a  temporary used inside the expansion of __builtin_va_arg?  So it
might not even be *spurious*, I suppose, it might be telling me that that
expansion is wrong!

Reply via email to