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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org
             Status|ASSIGNED                    |NEW
           Assignee|marxin at gcc dot gnu.org          |unassigned at gcc dot 
gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
A bit reduced test-case:

$ cat pr9862.C
#define variables  (const char* []){ "PK", "KEK", "db"}

int ret, len;

void isVariable(char *var)
{
  for (int v = 0; v < 2; v++)
    if (__builtin_strncmp(var,variables[v], 2) == 0)
      ret = 0;
}

int main(int argc, char* argv[])
{
  __builtin_printf ("argv[0]=%s\n", argv[0]);
  isVariable(argv[0]);                  
  len = __builtin_strlen (argv[0]);
  return 0;
}

$ g++ pr9862.C -g -Os && valgrind --expensive-definedness-checks=yes ./a.out
==54436== Memcheck, a memory error detector
==54436== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==54436== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==54436== Command: ./a.out
==54436== 
argv[0]=./a.out
==54436== Use of uninitialised value of size 8
==54436==    at 0x100005F8: main (pr9862.C:16)

Can please anybody from Power folks take a look?

Reply via email to