From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12385 invoked by alias); 5 Sep 2012 18:13:08 -0000 Received: (qmail 12369 invoked by uid 22791); 5 Sep 2012 18:13:06 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX,TW_GC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Sep 2012 18:12:53 +0000 From: "toralf.foerster at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/54495] New: gcc gives a false warning in kernel/trace/trace_events_filter.c Date: Wed, 05 Sep 2012 18:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: toralf.foerster at gmx dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg00397.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D54495 Bug #: 54495 Summary: gcc gives a false warning in kernel/trace/trace_events_filter.c Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: toralf.foerster@gmx.de The current git tree of linux gave with gcc-4.6.3 : kernel/trace/trace_events_filter.c: In function =E2=80=98ftrace_function_set_filter_cb=E2=80=99: kernel/trace/trace_events_filter.c:2074:8: warning: =E2=80=98ret=E2=80=99 m= ay be used uninitialized in this function [-Wuninitialized]=20 which refers to this piece of code: 2002 static int __ftrace_function_set_filter(int filter, char *buf, int = len, 2003 struct function_filter_data *data) 2004 { 2005 int i, re_cnt, ret; 2006 int *reset; 2007 char **re; 2008=20=20 2009 reset =3D filter ? &data->first_filter : &data->first_notra= ce; 2010=20=20 2011 /* 2012 * The 'ip' field could have multiple filters set, separated 2013 * either by space or comma. We first cut the filter and ap= ply 2014 * all pieces separatelly. 2015 */ 2016 re =3D ftrace_function_filter_re(buf, len, &re_cnt); 2017 if (!re) 2018 return -EINVAL; 2019=20=20 2020 for (i =3D 0; i < re_cnt; i++) { 2021 ret =3D ftrace_function_set_regexp(data->ops, filte= r, *reset, 2022 re[i], strlen(re[i= ])); 2023 if (ret) 2024 break; 2025=20=20 2026 if (*reset) 2027 *reset =3D 0; 2028 } 2029=20=20 2030 argv_free(re); 2031 return ret; 2032 } ... 2061 static int ftrace_function_set_filter_cb(enum move_type move, 2062 struct filter_pred *pred, 2063 int *err, void *data) 2064 { 2065 /* Checking the node is valid for function trace. */ 2066 if ((move !=3D MOVE_DOWN) || 2067 (pred->left !=3D FILTER_PRED_INVALID)) { 2068 *err =3D ftrace_function_check_pred(pred, 0); 2069 } else { 2070 *err =3D ftrace_function_check_pred(pred, 1); 2071 if (*err) 2072 return WALK_PRED_ABORT; 2073=20 2074 *err =3D __ftrace_function_set_filter(pred->op =3D= =3D OP_EQ, 2075=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 pred->regex.pattern, 2076 pred->regex.len, 2077 data); 2078 } 2079=20 2080 return (*err) ? WALK_PRED_ABORT : WALK_PRED_DEFAULT; 2081 } 2082=20=20 Both a kernel dev : >Strange, as ret is initialized to 'ret =3D -EINVAL;' in >__ftrace_function_set_filter(). I'm thinking that gcc got confused here. and a Gentoo Linux User points me to file a bug about this. I'm running an almost stable Gentoo linux : $ gcc -v Using built-in specs.=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 COLLECT_GCC=3D/usr/i686-pc-linux-gnu/gcc-bin/4.6.3/gcc=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/i686-pc-linux-gnu/4.6.3/lto-wrapper= =20=20=20=20=20=20=20=20 Target: i686-pc-linux-gnu=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 Configured with: /var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/config= ure --prefix=3D/usr --bindir=3D/usr/i686-pc-linux-gnu/gcc-bin/4.6.3 --includedir=3D/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include --datadir=3D/usr/share/gcc-data/i686-pc-linux-gnu/4.6.3 --mandir=3D/usr/share/gcc-data/i686-pc-linux-gnu/4.6.3/man --infodir=3D/usr/share/gcc-data/i686-pc-linux-gnu/4.6.3/info --with-gxx-include-dir=3D/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4 --host=3Di686-pc-linux-gnu --build=3Di686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-n= ls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=3D/share/gcc-data/i686-pc-linux-gnu/4.6.3/python --enable-checking=3Drelease --disable-libgcj --with-arch=3Di686 --enable-languages=3Dc,c++,fortran --enable-shared --enable-threads=3Dposix --enable-__cxa_atexit --enable-clocale=3Dgnu --enable-targets=3Dall --with-bugurl=3Dhttp://bugs.gentoo.org/ --with-pkgversion=3D'Gentoo 4.6.3 p= 1.6, pie-0.5.2'=20=20=20=20=20=20=20=20=20=20=20 Thread model: posix=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 gcc version 4.6.3 (Gentoo 4.6.3 p1.6, pie-0.5.2)