mirror of git://sourceware.org/git/glibc.git
fnmatch: work around GCC compiler warning bug with uninit var
* posix/fnmatch_loop.c (FCT): Use a scalar not a one-item array. This works around a bug with x86-64 GCC 4.9.2 and earlier where 'gcc -O2 -Wmaybe-uninitialized' incorrectly complains "../locale/weightwc.h:93:7: warning: '*((void *)&str+4)' may be used uninitialized in this function [-Wmaybe-uninitialized]".
This commit is contained in:
parent
bde2667a22
commit
b1eda10e17
|
@ -1,3 +1,12 @@
|
||||||
|
2014-11-25 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
fnmatch: work around GCC compiler warning bug with uninit var
|
||||||
|
* posix/fnmatch_loop.c (FCT): Use a scalar not a one-item array.
|
||||||
|
This works around a bug with x86-64 GCC 4.9.2 and earlier
|
||||||
|
where 'gcc -O2 -Wmaybe-uninitialized' incorrectly complains
|
||||||
|
"../locale/weightwc.h:93:7: warning: '*((void *)&str+4)' may be
|
||||||
|
used uninitialized in this function [-Wmaybe-uninitialized]".
|
||||||
|
|
||||||
2014-11-25 Joseph Myers <joseph@codesourcery.com>
|
2014-11-25 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* posix/bug-regex31.c (main): Return RES not 0.
|
* posix/bug-regex31.c (main): Return RES not 0.
|
||||||
|
|
|
@ -343,7 +343,12 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
else if (c == L('[') && *p == L('='))
|
else if (c == L('[') && *p == L('='))
|
||||||
{
|
{
|
||||||
UCHAR str[1];
|
/* It's important that STR be a scalar variable rather
|
||||||
|
than a one-element array, because GCC (at least 4.9.2
|
||||||
|
-O2 on x86-64) can be confused by the array and
|
||||||
|
diagnose a "used initialized" in a dead branch in the
|
||||||
|
findidx function. */
|
||||||
|
UCHAR str;
|
||||||
uint32_t nrules =
|
uint32_t nrules =
|
||||||
_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
|
_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
|
||||||
const CHAR *startp = p;
|
const CHAR *startp = p;
|
||||||
|
@ -355,7 +360,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||||
c = L('[');
|
c = L('[');
|
||||||
goto normal_bracket;
|
goto normal_bracket;
|
||||||
}
|
}
|
||||||
str[0] = c;
|
str = c;
|
||||||
|
|
||||||
c = *++p;
|
c = *++p;
|
||||||
if (c != L('=') || p[1] != L(']'))
|
if (c != L('=') || p[1] != L(']'))
|
||||||
|
@ -368,7 +373,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||||
|
|
||||||
if (nrules == 0)
|
if (nrules == 0)
|
||||||
{
|
{
|
||||||
if ((UCHAR) *n == str[0])
|
if ((UCHAR) *n == str)
|
||||||
goto matched;
|
goto matched;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -383,7 +388,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||||
# endif
|
# endif
|
||||||
const int32_t *indirect;
|
const int32_t *indirect;
|
||||||
int32_t idx;
|
int32_t idx;
|
||||||
const UCHAR *cp = (const UCHAR *) str;
|
const UCHAR *cp = (const UCHAR *) &str;
|
||||||
|
|
||||||
# if WIDE_CHAR_VERSION
|
# if WIDE_CHAR_VERSION
|
||||||
table = (const int32_t *)
|
table = (const int32_t *)
|
||||||
|
|
Loading…
Reference in New Issue