From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18751 invoked by alias); 28 Jul 2014 01:53:07 -0000 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 Received: (qmail 16667 invoked by uid 48); 28 Jul 2014 01:52:49 -0000 From: "thakis at chromium dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly Date: Mon, 28 Jul 2014 01:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: thakis at chromium dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg01794.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61596 --- Comment #2 from thakis at chromium dot org --- Here's a similar example that doesn't need C++1y, regular C++11 is sufficie= nt: thakis@ubu:~$ cat test.cc template void template_fun(T t) { typename T::Foo s3foo; // YYY (void)s3foo; } void template_fun_user() { struct Local { typedef int Foo; // XXX } p; template_fun(p); } thakis@ubu:~$ g++ -c test.cc -std=3Dc++11 -Wall test.cc: In function =E2=80=98void template_fun_user()=E2=80=99: test.cc:8:17: warning: typedef =E2=80=98template_fun_user()::Local::Foo=E2= =80=99 locally defined but not used [-Wunused-local-typedefs] typedef int Foo; ^ Maybe a possible fix is to store all typedefs that get this warning as candidates, and then emit warnings at the end of the translation unit for a= ll candidates that are still unreferenced at that point. >>From gcc-bugs-return-457204-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 28 04:34:57 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 1241 invoked by alias); 28 Jul 2014 04:34:56 -0000 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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 1181 invoked by uid 48); 28 Jul 2014 04:34:50 -0000 From: "ishiura-compiler at ml dot kwansei.ac.jp" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/61931] New: Wrong Constant Folding Date: Mon, 28 Jul 2014 04:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.4 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ishiura-compiler at ml dot kwansei.ac.jp X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg01795.txt.bz2 Content-length: 3088 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61931 Bug ID: 61931 Summary: Wrong Constant Folding Product: gcc Version: 4.8.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ishiura-compiler at ml dot kwansei.ac.jp GCC 4.8.4 for arm miscompiles the following code. $ cat test.c int a, b, c, d, e, f, g, h; long long i; int main (void) { int j; i = a - ((((b | ((1LL * c) >> 1)) / 3) | (1 << (1 / (e + 1)))) | 1); j = ((((1 % (1LLU << f)) & (((1LLU >> h)) - (63LLU * d)))) << 1) == ((1LL % (g + 1)) * a); if (i == 1); else __builtin_printf ("%lld, j = %lld\n", 0, j); } $ arm-none-eabi-gcc-4.8.4 test.c -o test.out -O1 --specs=rdimon.specs $ qemu-arm -L /usr/arm-linux-gnueabihf/ ./test.out 1, j = 0 $ arm-none-eabi-gcc-4.8.4 test.c -o test.out -O0 --specs=rdimon.specs $ qemu-arm -L /usr/arm-linux-gnueabihf/ ./test.out -12884901887, j = 0 $ arm-none-eabi-gcc-4.8.4 -v Using built-in specs. COLLECT_GCC=arm-none-eabi-gcc-4.8.4 COLLECT_LTO_WRAPPER=/home/ishiuraken/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.8.4/lto-wrapper Target: arm-none-eabi Configured with: /home/build/work/GCC-4-8-build/src/gcc/configure --target=arm-none-eabi --prefix=/home/build/work/GCC-4-8-build/install-native --libexecdir=/home/build/work/GCC-4-8-build/install-native/lib --infodir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-8-build/install-native/arm-none-eabi --build=i686-linux-gnu --host=i686-linux-gnu --with-gmp=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-mpfr=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-mpc=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-isl=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-cloog=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-libelf=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r Thread model: single gcc version 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358] (GNU Tools for ARM Embedded Processors)