public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
@ 2014-06-24 16:49 thakis at chromium dot org
  2014-06-26 17:01 ` [Bug c++/61596] " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: thakis at chromium dot org @ 2014-06-24 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61596
           Summary: -Wunused-local-typedefs warns incorrectly on a typedef
                    that's referenced indirectly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thakis at chromium dot org

-Wunused-local-typedefs warns that the typedef in line "XXX" is unused, but
it's used in line "YYY":

auto f() {
  struct S {
    typedef int t; // XXX
  };
  return S();
}
void g() {
  auto x = f();
  decltype(x)::t y; // YYY
}

/example.cpp: In function ‘auto f()’:

2 : warning: typedef ‘f()::S::t’ locally defined but not used
[-Wunused-local-typedefs]

struct S { typedef int t; };

^

(This is with 4.9.0. Testcase from Richard Smith.)
>From gcc-bugs-return-454805-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 24 17:03:36 2014
Return-Path: <gcc-bugs-return-454805-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31502 invoked by alias); 24 Jun 2014 17:03:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31455 invoked by uid 55); 24 Jun 2014 17:03:33 -0000
From: "ro at CeBiTec dot Uni-Bielefeld.DE" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61268] [4.10 regression] ICE in vt_expand_var_loc_chain, at var-tracking.c:8262
Date: Tue, 24 Jun 2014 17:03:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ro at CeBiTec dot Uni-Bielefeld.DE
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rsandifo at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61268-4-2wIVzqJ8dS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61268-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61268-4@http.gcc.gnu.org/bugzilla/>
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-06/txt/msg01887.txt.bz2
Content-length: 682

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida268

--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #6 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
>> --- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
> [...]
>> The patch passed bootstrap on x86_64-linux-gnu but could you test it for
>> sparc too?
>
> Sure: sparc-sun-solaris2.11 bootstrap in progress.  I'll be leaving for
> a short vacation before that finishes, so don't expect a result before
> tuesday next week.

The bootstrap finished successfully and the ICE is gone.

Thanks.
        Rainer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
  2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
@ 2014-06-26 17:01 ` paolo.carlini at oracle dot com
  2014-07-28  1:53 ` thakis at chromium dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-26 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-06-26
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Dodji, can you have a look?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
  2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
  2014-06-26 17:01 ` [Bug c++/61596] " paolo.carlini at oracle dot com
@ 2014-07-28  1:53 ` thakis at chromium dot org
  2022-01-24 12:29 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: thakis at chromium dot org @ 2014-07-28  1:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from thakis at chromium dot org ---
Here's a similar example that doesn't need C++1y, regular C++11 is sufficient:

thakis@ubu:~$ cat test.cc
template <class T>
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=c++11 -Wall
test.cc: In function ‘void template_fun_user()’:
test.cc:8:17: warning: typedef ‘template_fun_user()::Local::Foo’ 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 all
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: <gcc-bugs-return-457204-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
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: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
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" <gcc-bugzilla@gcc.gnu.org>
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: <bug-61931-4@http.gcc.gnu.org/bugzilla/>
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?ida931

            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)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
  2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
  2014-06-26 17:01 ` [Bug c++/61596] " paolo.carlini at oracle dot com
  2014-07-28  1:53 ` thakis at chromium dot org
@ 2022-01-24 12:29 ` redi at gcc dot gnu.org
  2022-01-25 21:09 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-24 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2014-06-26 00:00:00         |2022-1-24

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This now warns about libstdc++ code, see PR 104019:

/build/trunk/x86_64-unknown-dragonfly6.3/libstdc++-v3/include/bits/shared_ptr_base.h:
In member function 'void std::_Sp_counted_array_base<_Alloc>::_M_init(typename
std::allocator_traits<_Alloc>::value_type*, _Init)':
/build/trunk/x86_64-unknown-dragonfly6.3/libstdc++-v3/include/bits/shared_ptr_base.h:767:
warning: typedef 'using value_type = using _Up = typename
std::allocator_traits<_Alloc>::value_type' locally defined but not used
[-Wunused-local-typedefs]
/build/trunk/x86_64-unknown-dragonfly6.3/libstdc++-v3/include/bits/shared_ptr_base.h:768:
warning: typedef 'using difference_type = std::ptrdiff_t' locally defined but
not used [-Wunused-local-typedefs]
/build/trunk/x86_64-unknown-dragonfly6.3/libstdc++-v3/include/bits/shared_ptr_base.h:771:
warning: typedef 'using iterator_category = struct std::forward_iterator_tag'
locally defined but not used [-Wunused-local-typedefs]
In file included from
/build/trunk/x86_64-unknown-dragonfly6.3/libstdc++-v3/include/x86_64-unknown-dragonfly6.3/bits/stdc++.h:144:

Those typedefs are 100% necessary because otherwise the local class is not a
valid iterator type.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
  2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
                   ` (2 preceding siblings ...)
  2022-01-24 12:29 ` redi at gcc dot gnu.org
@ 2022-01-25 21:09 ` cvs-commit at gcc dot gnu.org
  2022-03-07 10:46 ` redi at gcc dot gnu.org
  2022-10-30 20:13 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-25 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:5c1f274e3e090ee03bedc22dd7169b28e759974e

commit r12-6868-g5c1f274e3e090ee03bedc22dd7169b28e759974e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 25 10:22:42 2022 +0000

    libstdc++: Avoid some more warnings [PR104019]

    With -fno-exceptions we get a -Wmisleading-indentation warning for:

      if (cond)
        __try {}
        __catch (...) {}

    This is because the __catch(...) expands to if (false), but is indented
    as though it is controlled by the preceding 'if'. Surround it in braces.

    The new make_shared<T[]> code triggers a bogus warning due to PR 61596,
    which can be disabled with a pragma.

    libstdc++-v3/ChangeLog:

            PR libstdc++/104019
            * include/bits/istream.tcc (basic_istream::sentry): Add braces
            around try-block.
            * include/bits/shared_ptr_base.h (_Sp_counted_array_base::_M_init):
            Add pragmas to disable bogus warnings from PR 61596.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
  2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
                   ` (3 preceding siblings ...)
  2022-01-25 21:09 ` cvs-commit at gcc dot gnu.org
@ 2022-03-07 10:46 ` redi at gcc dot gnu.org
  2022-10-30 20:13 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-07 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.j.odwyer at gmail dot com

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 104792 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly
  2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
                   ` (4 preceding siblings ...)
  2022-03-07 10:46 ` redi at gcc dot gnu.org
@ 2022-10-30 20:13 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-30 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redbeard0531 at gmail dot com

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 105560 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-30 20:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 16:49 [Bug c++/61596] New: -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly thakis at chromium dot org
2014-06-26 17:01 ` [Bug c++/61596] " paolo.carlini at oracle dot com
2014-07-28  1:53 ` thakis at chromium dot org
2022-01-24 12:29 ` redi at gcc dot gnu.org
2022-01-25 21:09 ` cvs-commit at gcc dot gnu.org
2022-03-07 10:46 ` redi at gcc dot gnu.org
2022-10-30 20:13 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).