public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
@ 2014-01-16 23:52 ` pinskia at gcc dot gnu.org
  2014-01-16 23:55 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-01-16 23:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

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


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
  2014-01-16 23:52 ` [Bug c/28901] -Wunused-variable ignores unused const initialised variables pinskia at gcc dot gnu.org
@ 2014-01-16 23:55 ` pinskia at gcc dot gnu.org
  2014-01-17  0:26 ` hjl.tools at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-01-16 23:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>From the code:
       /* We don't warn about "static const" variables because the
      "rcs_id" idiom uses that construction.  */


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
  2014-01-16 23:52 ` [Bug c/28901] -Wunused-variable ignores unused const initialised variables pinskia at gcc dot gnu.org
  2014-01-16 23:55 ` pinskia at gcc dot gnu.org
@ 2014-01-17  0:26 ` hjl.tools at gmail dot com
  2014-02-11 17:39 ` tromey at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-01-17  0:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Andrew Pinski from comment #3)
> From the code:
>        /* We don't warn about "static const" variables because the
> 	  "rcs_id" idiom uses that construction.  */

That is not a good reason not to warn:

[hjl@gnu-mic-2 gcc]$ cat /tmp/w.c
static const int foo[0x1000];
[hjl@gnu-mic-2 gcc]$ gcc  -Wall -S /tmp/w.c
[hjl@gnu-mic-2 gcc]$ cat w.s
    .file    "w.c"
    .local    foo
    .comm    foo,16384,32
    .ident    "GCC: (GNU) 4.8.2 20140115 (Red Hat 4.8.2-11)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-mic-2 gcc]$ 

If we want to avoid rcs_id warning, we can check it explicitly and
not to warn it.
>From gcc-bugs-return-440649-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 17 00:42:30 2014
Return-Path: <gcc-bugs-return-440649-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19613 invoked by alias); 17 Jan 2014 00:42:29 -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 19574 invoked by uid 48); 17 Jan 2014 00:42:26 -0000
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/55478] [devirt] trunk fails inline-devirt test #4
Date: Fri, 17 Jan 2014 00:42: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.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hubicka at gcc dot gnu.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: bug_status assigned_to
Message-ID: <bug-55478-4-UvLwZHCBMA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55478-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55478-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-01/txt/msg01791.txt.bz2
Content-length: 1047

http://gcc.gnu.org/bugzilla/show_bug.cgi?idU478

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

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

--- Comment #12 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
print_length is not really a trivial wrapper:
void print_length (const String& string)
{
  for (uint64_t i = 0; i < string.length(); i++)
    {
      printf("%d\n", string.get(i));
    }
}

and the fact that it disappears depends on
 1) ability to inline it
 2) ability to devirtualize length and get calls
 3) ability to eliminate the loop since length is small.

Inlined can anticiapte 1-2 to happen, but not 3 and with -O2 it decides that
code size would grow.

For 3 one would need return functions to start with to determine the constant
bound. So we can get it better only once Martin gets to it ;)


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-01-17  0:26 ` hjl.tools at gmail dot com
@ 2014-02-11 17:39 ` tromey at gcc dot gnu.org
  2014-08-08 14:18 ` tromey at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tromey at gcc dot gnu.org @ 2014-02-11 17:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu.org

--- Comment #5 from Tom Tromey <tromey at gcc dot gnu.org> ---
I would like this bug to be reopened.

I've read through this bug and various dups,
and it seems that there are two rationales given
for skipping the warning for const statics:

1. rcs_id.  It seems to me that this case could
   be handled by __attribute__((used)).

2. "static const"s appearing in system headers.
   It seems to me that this could be handled by
   the usual in_system_header_at check.

This warning would have caught a couple of previously
unnoticed bugs in gdb:
https://sourceware.org/ml/gdb-patches/2014-02/msg00342.html


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-02-11 17:39 ` tromey at gcc dot gnu.org
@ 2014-08-08 14:18 ` tromey at gcc dot gnu.org
  2014-10-22 18:55 ` petschy at gmail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tromey at gcc dot gnu.org @ 2014-08-08 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2014-08-08
         Resolution|INVALID                     |---
     Ever confirmed|0                           |1

--- Comment #6 from Tom Tromey <tromey at gcc dot gnu.org> ---
I finally decided I would just reopen it.
If this is in error someone can easily close it again.
However please take note of the arguments in favor of
this being a bug in comment #5.  Thanks.


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-08-08 14:18 ` tromey at gcc dot gnu.org
@ 2014-10-22 18:55 ` petschy at gmail dot com
  2015-09-11 22:15 ` mark at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: petschy at gmail dot com @ 2014-10-22 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

petschy at gmail dot com changed:

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

--- Comment #7 from petschy at gmail dot com ---
For backward compatibility, wouldn't it be better to add a new flag,
-Wunused-static-const-variable, instead of changing the behaviour of
-Wunused-variable?


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-10-22 18:55 ` petschy at gmail dot com
@ 2015-09-11 22:15 ` mark at gcc dot gnu.org
  2015-09-14  9:50 ` mark at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mark at gcc dot gnu.org @ 2015-09-11 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Mark Wielaard <mark at gcc dot gnu.org> ---
Submitted a patch:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00847.html


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2015-09-11 22:15 ` mark at gcc dot gnu.org
@ 2015-09-14  9:50 ` mark at gcc dot gnu.org
  2015-09-18 23:06 ` eggert at gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mark at gcc dot gnu.org @ 2015-09-14  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Mark Wielaard <mark at gcc dot gnu.org> ---
Author: mark
Date: Mon Sep 14 09:49:47 2015
New Revision: 227742

URL: https://gcc.gnu.org/viewcvs?rev=227742&root=gcc&view=rev
Log:
PR28901 -Wunused-variable ignores unused const initialised variables in C

12 years ago it was decided that -Wunused-variable shouldn't warn about
static const variables because some code used const static char rcsid[]
strings which were never used but wanted in the code anyway. But as the
bug points out this hides some real bugs. These days the usage of rcsids
is not very popular anymore. So this patch changes the default to warn
about unused static const variables in C with -Wunused-variable. And it
adds a new option -Wno-unused-const-variable to turn this warning off.
For C++ this new warning is off by default, since const variables can be
used as #defines in C++. New testcases for the new defaults in C and C++
are included testing the new warning and suppressing it with an unused
attribute or using -Wno-unused-const-variable.

gcc/ChangeLog

       PR c/28901
       * toplev.c (check_global_declaration): Check and use
       warn_unused_const_variable.
       * doc/invoke.texi (Warning Options): Add -Wunused-const-variable.
       (-Wunused-variable): Remove non-constant. For C implies
       -Wunused-const-variable.
       (-Wunused-const-variable): New.

gcc/c-family/ChangeLog

       PR c/28901
       * c.opt (Wunused-variable): Option from common.opt.
       (Wunused-const-variable): New option.

gcc/cp/ChangeLog

       PR c/28901
       * cp-objcp-common.c (cxx_warn_unused_global_decl): Remove hard-coded
       VAR_P TREE_READONLY override.

gcc/testsuite/ChangeLog

       PR c/28901
       * g++.dg/warn/unused-variable-1.C: New test.
       * g++.dg/warn/unused-variable-2.C: Likewise.
       * gcc.dg/unused-4.c: Adjust warning for static const.
       * gcc.dg/unused-variable-1.c: New test.
       * gcc.dg/unused-variable-2.c: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/warn/unused-variable-1.C
    trunk/gcc/testsuite/g++.dg/warn/unused-variable-2.C
    trunk/gcc/testsuite/gcc.dg/unused-variable-1.c
    trunk/gcc/testsuite/gcc.dg/unused-variable-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c.opt
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-objcp-common.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/unused-4.c
    trunk/gcc/toplev.c


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2015-09-14  9:50 ` mark at gcc dot gnu.org
@ 2015-09-18 23:06 ` eggert at gnu dot org
  2015-09-18 23:43 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: eggert at gnu dot org @ 2015-09-18 23:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Eggert <eggert at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eggert at gnu dot org

--- Comment #10 from Paul Eggert <eggert at gnu dot org> ---
This topic came up on the libc-alpha mailing list.  The proposed change would
break compilation of tzcode, which has a private header that defines static
constants not all of which are used in every file that includes the header.

In tzcode the problem can be worked around by using a #define rather than a
static constant, but many C programmers nowadays prefer avoiding #define when
possible, and static constants let you do that in many cases. (An enum wouldn't
work for the tzcode case, as the values might be outside int range.)  Also, in
many environments macros are invisible to the debugger but static constants are
visible, so the static constants are nicer for people debugging their code.

This reminds me of when gcc -Wmissing-declarations used to diagnose every
C99-style inline function in an include file (GCC bug 63877). The warning was
put in and tested, but the tests used only old-fashioned C programming styles,
and the warning caused real problems by people using a more modern C style.

It'd be fine to add an option to enable the new warning, but please don't
enable them merely because -Wall or -Wunused-variable is specified.


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2015-09-18 23:06 ` eggert at gnu dot org
@ 2015-09-18 23:43 ` manu at gcc dot gnu.org
  2015-09-19  4:51 ` eggert at gnu dot org
  2015-09-19  9:27 ` manu at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu.org @ 2015-09-18 23:43 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #11 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #10)
> In tzcode the problem can be worked around by using a #define rather than a
> static constant, but many C programmers nowadays prefer avoiding #define

__attribute__((unused)) should silence the warning when inappropriate.

Another alternative is to only warn if the variable is defined in the main file
(MAIN_FILE_P) as opposed to an included file.

> It'd be fine to add an option to enable the new warning, but please don't
> enable them merely because -Wall or -Wunused-variable is specified.

The problem with not adding options to at least -Wall or -Wextra is that they
will be almost never used, even if they are only noisy for a small percentage
of cases, which just may need a bit of fine-tuning or accepting some false
negatives to avoid some false positives. 

We have a lot of options that are not in Wall or Wextra just because they were
noisy in some particular cases, and it was easier to move them out of the way
than to fix them. Since they are not used, there is small motivation to ever
fix them.
>From gcc-bugs-return-497554-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 19 00:14:59 2015
Return-Path: <gcc-bugs-return-497554-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 71443 invoked by alias); 19 Sep 2015 00:14:59 -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 71411 invoked by uid 48); 19 Sep 2015 00:14:55 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/67634] New: Can't preserve bound register in interrupt handler
Date: Sat, 19 Sep 2015 00:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 cc blocked target_milestone
Message-ID: <bug-67634-4@http.gcc.gnu.org/bugzilla/>
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: 2015-09/txt/msg01532.txt.bz2
Content-length: 2183

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

            Bug ID: 67634
           Summary: Can't preserve bound register in interrupt handler
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: julia.koval at intel dot com
            Blocks: 67552
  Target Milestone: ---

[hjl@gnu-6 interrupt-6]$ cat bnd.i 
void
__attribute__((interrupt))
fn1 (void)
{
  asm ("#"
       :
       : 
       : "bnd0");
}
[hjl@gnu-6 interrupt-6]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -mmpx -g -S -o bnd.s bnd.i
bnd.i: In function ‘fn1’:
bnd.i:9:1: error: insn does not satisfy its constraints:
 }
 ^
(insn/f 9 3 10 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg:DI 77 bnd0)) bnd.i:4 61 {*pushdi2_rex64}
     (expr_list:REG_DEAD (reg:DI 77 bnd0)
        (nil)))
bnd.i:9:1: internal compiler error: in extract_constrain_insn, at recog.c:2200
0xcf01e5 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /export/gnu/import/git/sources/gcc/gcc/rtl-error.c:109
0xcf0245 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /export/gnu/import/git/sources/gcc/gcc/rtl-error.c:120
0xca21a2 extract_constrain_insn(rtx_insn*)
        /export/gnu/import/git/sources/gcc/gcc/recog.c:2200
0xcb080f copyprop_hardreg_forward_1
        /export/gnu/import/git/sources/gcc/gcc/regcprop.c:778
0xcb2040 execute
        /export/gnu/import/git/sources/gcc/gcc/regcprop.c:1268
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Makefile:27: recipe for target 'bnd.s' failed
make: *** [bnd.s] Error 1
[hjl@gnu-6 interrupt-6]$ 

We can't use push to save bound registers.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67552
[Bug 67552] [meta] x86 interrupt attribute
>From gcc-bugs-return-497555-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 19 01:25:05 2015
Return-Path: <gcc-bugs-return-497555-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 35101 invoked by alias); 19 Sep 2015 01:25:04 -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 34687 invoked by uid 48); 19 Sep 2015 01:25:00 -0000
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67573] [SH] wrong code generated for libstdc++-v3/src/c++11/cxx11-shim_facets.cc at -mlra
Date: Sat, 19 Sep 2015 01:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: olegendo at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
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: <bug-67573-4-rpjqgMw1ae@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67573-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67573-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: 2015-09/txt/msg01533.txt.bz2
Content-length: 254

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

--- Comment #9 from Oleg Endo <olegendo at gcc dot gnu.org> ---
I think this should be backported to GCC 5.  Even if it might not be triggered
often, there is a possibility for silent wrong-code bugs.


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2015-09-18 23:43 ` manu at gcc dot gnu.org
@ 2015-09-19  4:51 ` eggert at gnu dot org
  2015-09-19  9:27 ` manu at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: eggert at gnu dot org @ 2015-09-19  4:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Paul Eggert <eggert at gnu dot org> ---
(In reply to Manuel López-Ibáñez from comment #11)

> Another alternative is to only warn if the variable is defined in the main
> file (MAIN_FILE_P) as opposed to an included file.

Thanks, this is a reasonable suggestion; it would fix the cry-wolf problem for
tzcode, which is what prompted me to object to the original proposal.

The alternative of littering the code with many instances of __attribute__
((unused)) (or is it __attribute ((used)? I can never remember) is less
appealing.
>From gcc-bugs-return-497560-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 19 08:08:08 2015
Return-Path: <gcc-bugs-return-497560-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15685 invoked by alias); 19 Sep 2015 08:08:08 -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 15632 invoked by uid 48); 19 Sep 2015 08:08:04 -0000
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67636] New: [6 Regression][SH] gcc.target/sh/pr54236-1.c failures
Date: Sat, 19 Sep 2015 08:08:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: olegendo at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 cc target_milestone cf_gcctarget
Message-ID: <bug-67636-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: 2015-09/txt/msg01538.txt.bz2
Content-length: 3547

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

            Bug ID: 67636
           Summary: [6 Regression][SH] gcc.target/sh/pr54236-1.c failures
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
                CC: segher at gcc dot gnu.org
  Target Milestone: ---
            Target: sh*-*-*

The following new failure popped up a while ago.

non-SH2A:
FAIL: gcc.target/sh/pr54236-1.c scan-assembler-times negc 2

SH2A:
FAIL: gcc.target/sh/pr54236-1.c scan-assembler-times bld 1
FAIL: gcc.target/sh/pr54236-1.c scan-assembler-times movt 1

The failing sub test is:

int
test_07 (int *vec)
{
  /* Must not see a 'sett' or 'addc' here.
     This is a case where combine tries to produce
     'a + (0 - b) + 1' out of 'a - b + 1'.
     On non-SH2A there is a 'tst + negc', on SH2A a 'bld + movt'.  */
  int z = vec[0];
  int vi = vec[1];
  int zi = vec[2];

  if (zi != 0 && z < -1)
    vi -= (((vi >> 7) & 0x01) << 1) - 1;

  return vi;
}


For non-SH2A GCC 5 produces:
        mov.l   @(8,r4),r1
        tst     r1,r1
        bt/s    .L9
        mov.l   @(4,r4),r0
        mov.l   @r4,r1
        mov     #-1,r2
        cmp/gt  r1,r2
        bf/s    .L9

        tst     #128,r0
        mov     #-1,r1
        negc    r1,r1
        add     r1,r1   r1 = T << 1
        sub     r1,r0   r0 = r0 - (T << 1)
        add     #1,r0   r0 = r0 - (T << 1) + 1
.L9:
        rts
        nop

For SH2A GCC 5 produces:
        mov.l   @(8,r4),r1
        mov.l   @(4,r4),r0
        tst     r1,r1
        bt.s    .L9
        mov     #-1,r1
        mov.l   @r4,r2
        cmp/ge  r1,r2
        bt.s    .L9

        bld     #7,r0
        movt    r1
        add     r1,r1
        sub     r1,r0
        add     #1,r0
.L9:
        rts/n

Now, trunk produces for both, non-SH2A and SH2A (only the relevant BB):
        ...
        bt.s    .L9

        mov     r0,r1
        shlr2   r1
        shlr2   r1
        shlr2   r1
        mov     #2,r2
        and     r2,r1
        sub     r1,r0
        add     #1,r0

In GCC 5 combine was using zero_extract for the bit test.  Now it tries
something like:

Failed to match this instruction:
(set (reg/v:SI 162 [ vi ])
    (plus:SI (minus:SI (reg/v:SI 162 [ vi ])
            (and:SI (lshiftrt:SI (reg/v:SI 162 [ vi ])
                    (const_int 6 [0x6]))
                (const_int 2 [0x2])))
        (const_int 1 [0x1])))

i.e. x - ((y >> 6) & 2) + 1


Both GCC 5 and trunk are not optimal.

On non-SH2A the T bit calculation goes like this:
  r0 = r0 - 2*(1 - T) - 1
     = r0 - 2 + 2*T - 1
     = r0 - 3 + 2*T

which could be realized as:
        tst     #128,r0
        mov     #-3,r1
        movt    r2
        addc    r1,r0
        add     r2,r0

On SH2A the bld insn can be used:
        bld     #7,r0
        movt    r2
        mov     #-1,r1
        addc    r1,r0
        add     r2,r0

If the constants for addc are hoisted out of the loop, this results in 4 insns
for non-SH2A and for SH2A.  However, without the zero_extract this is a bit
clunky to catch.

It'd be easier if this sub-rtx:

(and:SI (lshiftrt:SI (reg/v:SI 162 [ vi ])
                     (const_int 6 [0x6]))
        (const_int 2 [0x2])))

... was matched as:

(ashift:SI (zero_extract:SI (reg/v:SI 162 [ vi ])
                            (const_int 1)
                            (const_int 7))
           (const_int 1))


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
       [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2015-09-19  4:51 ` eggert at gnu dot org
@ 2015-09-19  9:27 ` manu at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu.org @ 2015-09-19  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #12)
> (In reply to Manuel López-Ibáñez from comment #11)
> 
> > Another alternative is to only warn if the variable is defined in the main
> > file (MAIN_FILE_P) as opposed to an included file.
> 
> Thanks, this is a reasonable suggestion; it would fix the cry-wolf problem
> for tzcode, which is what prompted me to object to the original proposal.
> 
> The alternative of littering the code with many instances of __attribute__
> ((unused)) (or is it __attribute ((used)? I can never remember) is less
> appealing.

https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-g_t_0040code_007bunused_007d-variable-attribute-3382

unused
    This attribute, attached to a variable, means that the variable is meant to
be possibly unused. GCC does not produce a warning for this variable.

used
    This attribute, attached to a variable with static storage, means that the
variable must be emitted even if it appears that the variable is not
referenced.

(I think "used" should also silence the warning).
>From gcc-bugs-return-497563-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 19 09:56:23 2015
Return-Path: <gcc-bugs-return-497563-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 130503 invoked by alias); 19 Sep 2015 09:56:23 -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 130455 invoked by uid 48); 19 Sep 2015 09:56:19 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/67085] priority queue should not copy comparators when calling push_heap and pop_heap
Date: Sat, 19 Sep 2015 09:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Resolution:
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_status cf_reconfirmed_on resolution everconfirmed
Message-ID: <bug-67085-4-f4nE9mig5X@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67085-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67085-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: 2015-09/txt/msg01541.txt.bz2
Content-length: 731

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2015-09-19
         Resolution|WONTFIX                     |---
     Ever confirmed|0                           |1

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Although the workarounds suggested here are not valid, I think we can do better
internally in the library, maybe by adding a private __push_heap that takes a
reference and using that instead of push_heap.


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

* [Bug c/28901] -Wunused-variable ignores unused const initialised variables
  2006-08-30 11:55 [Bug c/28901] New: " mikpe at csd dot uu dot se
@ 2006-09-19  5:13 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  5:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-09-19 05:13 -------
This is not a bug but a feature.  The reason is that const int usually shows up
in header files and usually are normally unused.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901


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

end of thread, other threads:[~2015-09-19  9:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-28901-4@http.gcc.gnu.org/bugzilla/>
2014-01-16 23:52 ` [Bug c/28901] -Wunused-variable ignores unused const initialised variables pinskia at gcc dot gnu.org
2014-01-16 23:55 ` pinskia at gcc dot gnu.org
2014-01-17  0:26 ` hjl.tools at gmail dot com
2014-02-11 17:39 ` tromey at gcc dot gnu.org
2014-08-08 14:18 ` tromey at gcc dot gnu.org
2014-10-22 18:55 ` petschy at gmail dot com
2015-09-11 22:15 ` mark at gcc dot gnu.org
2015-09-14  9:50 ` mark at gcc dot gnu.org
2015-09-18 23:06 ` eggert at gnu dot org
2015-09-18 23:43 ` manu at gcc dot gnu.org
2015-09-19  4:51 ` eggert at gnu dot org
2015-09-19  9:27 ` manu at gcc dot gnu.org
2006-08-30 11:55 [Bug c/28901] New: " mikpe at csd dot uu dot se
2006-09-19  5:13 ` [Bug c/28901] " pinskia at gcc dot gnu dot 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).