public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template
@ 2013-11-21 12:43 a_mcgurn at yahoo dot co.uk
  2013-11-21 13:03 ` [Bug c++/59231] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: a_mcgurn at yahoo dot co.uk @ 2013-11-21 12:43 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 10860 bytes --]

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

            Bug ID: 59231
           Summary: gcc misses [-Werror=sign-compare] when inside a
                    template
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a_mcgurn at yahoo dot co.uk

The following code:

----------- //filename 
#include <iostream>

template<class X, class Y>
bool equals( X x, Y y )
{
    return (x == y);
}

int main()
{
   std::cout << "Hello World!" << std::endl;
   size_t x = 2;
   signed int y = 2;

   if(!equals( x, y ))
   {
      std::cout << "Hello World again - x == y !" << std::endl;
   }

   return 0;
}
-----------

This produces for g++-4.8.2:

bfs-dl360g7-27$ g++ --std=c++11 -Wall helloWorld.cpp -o helloWorld
NO warnings

for g++-4.4.7 it correctly warns on the 'signed == unsigned long' as incorrect:

bfs-dl360g7-27$ /usr/bin/g++ -Wall helloWorld.cpp -o helloWorld
helloWorld.cpp: In function âbool equals(X, Y) [with X = long unsigned int, Y =
int]â:
helloWorld.cpp:16:   instantiated from here
helloWorld.cpp:7: warning: comparison between signed and unsigned integer
expressions

----
However if comparison is not inside a template say direct comparison:
    if(x == y)

then g++-4.8.2 will pick this up as a warning:
bfs-dl360g7-27$ g++ --std=c++11 -Wall -Werror testComparison.cpp -o
testComparison
testComparison.cpp: In function âint main()â:
testComparison.cpp:9:12: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
    if(x == y)

so it appears to have difficulty seeing this issue if wrapped in a
template/macro.


bfs-dl360g7-27$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/gcc-4.8.2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/opt/gcc-4.8.2 --enable-languages=c,c++
--with-mpc=/opt/gcc-4.8.2 --with-mpfr=/opt/gcc-4.8.2 --with-gmp=/opt/gcc-.8.2
--with-cloog=/opt/gcc-4.8.2 --with-isl=/opt/gcc-4.8.2
Thread model: posix
gcc version 4.8.2 (GCC)

preprocessed file attached -
apologies if i've missed anything vital or a bug already raised.
rgds
>From gcc-bugs-return-435370-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 12:44:45 2013
Return-Path: <gcc-bugs-return-435370-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10515 invoked by alias); 21 Nov 2013 12:44:45 -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 10022 invoked by uid 48); 21 Nov 2013 12:43:50 -0000
From: "a_mcgurn at yahoo dot co.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59232] New: gcc misses [-Werror=sign-compare] when inside a template
Date: Thu, 21 Nov 2013 12:44: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-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: a_mcgurn at yahoo dot co.uk
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-59232-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: 2013-11/txt/msg02147.txt.bz2
Content-length: 2385

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

            Bug ID: 59232
           Summary: gcc misses [-Werror=sign-compare] when inside a
                    template
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a_mcgurn at yahoo dot co.uk

The following code:

----------- //filename 
#include <iostream>

template<class X, class Y>
bool equals( X x, Y y )
{
    return (x == y);
}

int main()
{
   std::cout << "Hello World!" << std::endl;
   size_t x = 2;
   signed int y = 2;

   if(!equals( x, y ))
   {
      std::cout << "Hello World again - x == y !" << std::endl;
   }

   return 0;
}
-----------

This produces for g++-4.8.2:

bfs-dl360g7-27$ g++ --std=c++11 -Wall helloWorld.cpp -o helloWorld
NO warnings

for g++-4.4.7 it correctly warns on the 'signed == unsigned long' as incorrect:

bfs-dl360g7-27$ /usr/bin/g++ -Wall helloWorld.cpp -o helloWorld
helloWorld.cpp: In function âbool equals(X, Y) [with X = long unsigned int, Y =
int]â:
helloWorld.cpp:16:   instantiated from here
helloWorld.cpp:7: warning: comparison between signed and unsigned integer
expressions

----
However if comparison is not inside a template say direct comparison:
    if(x == y)

then g++-4.8.2 will pick this up as a warning:
bfs-dl360g7-27$ g++ --std=c++11 -Wall -Werror testComparison.cpp -o
testComparison
testComparison.cpp: In function âint main()â:
testComparison.cpp:9:12: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
    if(x == y)

so it appears to have difficulty seeing this issue if wrapped in a
template/macro.


bfs-dl360g7-27$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/gcc-4.8.2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/opt/gcc-4.8.2 --enable-languages=c,c++
--with-mpc=/opt/gcc-4.8.2 --with-mpfr=/opt/gcc-4.8.2 --with-gmp=/opt/gcc-.8.2
--with-cloog=/opt/gcc-4.8.2 --with-isl=/opt/gcc-4.8.2
Thread model: posix
gcc version 4.8.2 (GCC)

preprocessed file attached -
apologies if i've missed anything vital or a bug already raised.
rgds
>From gcc-bugs-return-435371-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 12:47:56 2013
Return-Path: <gcc-bugs-return-435371-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12488 invoked by alias); 21 Nov 2013 12:47:55 -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 12405 invoked by uid 48); 21 Nov 2013 12:47:51 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59233] New: [4.9 Regression] C++ failures after revision 205058 on x86_64-apple-darwin13 with -m32
Date: Thu, 21 Nov 2013 12:47: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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
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 cc cf_gcchost cf_gcctarget cf_gccbuild attachments.created
Message-ID: <bug-59233-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: 2013-11/txt/msg02148.txt.bz2
Content-length: 2425

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

            Bug ID: 59233
           Summary: [4.9 Regression] C++ failures after revision 205058 on
                    x86_64-apple-darwin13 with -m32
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dominiq at lps dot ens.fr
                CC: iains at gcc dot gnu.org, tejohnson at gcc dot gnu.org
              Host: x86_64-apple-darwin13
            Target: x86_64-apple-darwin13
             Build: x86_64-apple-darwin13

Created attachment 31262
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id1262&actioníit
Preprocessed file for g++.dg/torture/pr52772.C

The following failures appeared on x86_64-apple-darwin13 with -m32 after
revision 205058 (205507 is OK):

FAIL: g++.dg/opt/pr57661.C (internal compiler error)
FAIL: g++.dg/opt/pr57661.C (test for excess errors)
FAIL: g++.dg/torture/pr52772.C  -Os  (internal compiler error)
FAIL: g++.dg/torture/pr52772.C  -Os  (test for excess errors)

FAIL: 23_containers/list/debug/invalidation/4.cc (test for excess errors)
UNRESOLVED: 23_containers/list/debug/invalidation/4.cc compilation failed to
produce executable
FAIL: ext/rope/2.cc (test for excess errors)
UNRESOLVED: ext/rope/2.cc compilation failed to produce executable
FAIL: ext/rope/5.cc (test for excess errors)

[Book15] f90/bug% g++ -c pr52772.ii -m32 -Os
/opt/gcc/work/gcc/testsuite/g++.dg/torture/pr52772.C: In member function 'int
c8::tria(c7*, c5*)':
/opt/gcc/work/gcc/testsuite/g++.dg/torture/pr52772.C:85:1: internal compiler
error: Segmentation fault: 11
 }
 ^

/opt/gcc/work/gcc/testsuite/g++.dg/torture/pr52772.C:85:1: internal compiler
error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Abort
[Book15] f90/bug% g++ -c pr57661.ii -m32 -O2 -fno-tree-forwprop -std=gnu++11
/opt/gcc/work/gcc/testsuite/g++.dg/opt/pr57661.C: In destructor 'I<U, V>::~I()
[with U = char; V = C<char>]':
/opt/gcc/work/gcc/testsuite/g++.dg/opt/pr57661.C:50:3: internal compiler error:
Segmentation fault: 11
   }
   ^

/opt/gcc/work/gcc/testsuite/g++.dg/opt/pr57661.C:50:3: internal compiler error:
Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Abort

I am attaching the preprocessed file for g++.dg/torture/pr52772.C.


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
@ 2013-11-21 13:03 ` rguenth at gcc dot gnu.org
  2013-11-21 13:05 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-21 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-21
   Target Milestone|---                         |4.8.3
            Summary|gcc misses                  |[4.8/4.9 Regression] gcc
                   |[-Werror=sign-compare] when |misses
                   |inside a template           |[-Werror=sign-compare] when
                   |                            |inside a template
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
  2013-11-21 13:03 ` [Bug c++/59231] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
@ 2013-11-21 13:05 ` rguenth at gcc dot gnu.org
  2013-11-21 15:06 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-21 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 59232 has been marked as a duplicate of this bug. ***


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
  2013-11-21 13:03 ` [Bug c++/59231] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
  2013-11-21 13:05 ` rguenth at gcc dot gnu.org
@ 2013-11-21 15:06 ` rguenth at gcc dot gnu.org
  2013-12-03 15:16 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-21 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (2 preceding siblings ...)
  2013-11-21 15:06 ` rguenth at gcc dot gnu.org
@ 2013-12-03 15:16 ` jakub at gcc dot gnu.org
  2013-12-03 16:07 ` manu at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-03 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This has changed in r187542 and from what I can see, the change was completely
intentional.


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (3 preceding siblings ...)
  2013-12-03 15:16 ` jakub at gcc dot gnu.org
@ 2013-12-03 16:07 ` manu at gcc dot gnu.org
  2014-01-24 18:21 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu.org @ 2013-12-03 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> This has changed in r187542 and from what I can see, the change was
> completely intentional.

Interestingly, the same was done recently in Clang:
http://llvm.org/bugs/show_bug.cgi?id=8682

That commit also killed warnings for non-dependant types within templates:

unsigned int z;
signed int w;

template<class X, class Y>
bool equals( X x, Y y )
{

    return (z == w);
}

(It would be nice to edit the log of that commit to fix the PR number, which
should be 11856).
>From gcc-bugs-return-436545-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 03 16:28:38 2013
Return-Path: <gcc-bugs-return-436545-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11811 invoked by alias); 3 Dec 2013 16:28:37 -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 11769 invoked by uid 48); 3 Dec 2013 16:28:33 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59268] [4.7/4.8/4.9 Regression] [c++11] ICE with constexpr in a virtual function
Date: Tue, 03 Dec 2013 16:28: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: 4.9.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-59268-4-aQlmDqD5ol@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59268-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59268-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: 2013-12/txt/msg00200.txt.bz2
Content-length: 444

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
ICE started with r172790, the first ICE supposedly fixed by PR55944.


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (4 preceding siblings ...)
  2013-12-03 16:07 ` manu at gcc dot gnu.org
@ 2014-01-24 18:21 ` jason at gcc dot gnu.org
  2014-01-24 19:36 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-24 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot com
         Depends on|                            |11856

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
In retrospect, I think that change (which I suggested) was wrong.  We don't
want to suppress all warnings just because we're in a template;
c_inhibit_evaluation_warnings should only be used when we aren't actually
generating code for an expression.

A better solution for 11856 would be to disable just -Wtype-limits in template
instantiations, or even just across the build_x_binary_op if the expression
before substitution is type-dependent.


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (5 preceding siblings ...)
  2014-01-24 18:21 ` jason at gcc dot gnu.org
@ 2014-01-24 19:36 ` paolo.carlini at oracle dot com
  2014-01-27 14:54 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-01-24 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
However, what Jason suggested at the time was "ANOTHER job for
c_inhibit_evaluation_warning" (emphasis mine). In my mind that was important
because I saw a clear consistency rationale in the fix. Before changing /
reverting anything here, we should therefore audit all those uses and figure
out which ones we want to remove and finally decide which replacement. Frankly,
I'm not sure this is 4.9 material (whoever does the job ;)


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (6 preceding siblings ...)
  2014-01-24 19:36 ` paolo.carlini at oracle dot com
@ 2014-01-27 14:54 ` jason at gcc dot gnu.org
  2014-02-26 18:50 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-27 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #6)
> However, what Jason suggested at the time was "ANOTHER job for
> c_inhibit_evaluation_warning" (emphasis mine). In my mind that was important
> because I saw a clear consistency rationale in the fix. Before changing /
> reverting anything here, we should therefore audit all those uses and figure
> out which ones we want to remove and finally decide which replacement.
> Frankly, I'm not sure this is 4.9 material (whoever does the job ;)

Yes, I saw it as a consistency issue.  But now I think that was forcing
consistency between two importantly different cases: the purpose of
c_inhibit_evaluation_warning is to avoid warning about evaluation issues for
expressions that are not actually evaluated.  But a template instantiation is
not an unevaluated context, so it's a different case.  Furthermore, the
-Wtype-limits warning still makes sense even in unevaluated context, so it
shouldn't be conditional on that.

I agree that an audit is needed here; we might want to introduce a new counter
to indicate dependent context and suppress some warnings within templates.  I
think this could still go into 4.9 if there's time to take care of it soon.


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (7 preceding siblings ...)
  2014-01-27 14:54 ` jason at gcc dot gnu.org
@ 2014-02-26 18:50 ` jason at gcc dot gnu.org
  2014-02-26 21:28 ` jason at gcc dot gnu.org
  2014-02-26 21:34 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-26 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (8 preceding siblings ...)
  2014-02-26 18:50 ` jason at gcc dot gnu.org
@ 2014-02-26 21:28 ` jason at gcc dot gnu.org
  2014-02-26 21:34 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-26 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Feb 26 21:28:08 2014
New Revision: 208183

URL: http://gcc.gnu.org/viewcvs?rev=208183&root=gcc&view=rev
Log:
    PR c++/59231
    PR c++/11586
    PR c++/14710
    PR c++/57132
gcc/
    * c-common.c (shorten_compare): Don't check
    c_inhibit_evaluation_warnings.
gcc/cp/
    * pt.c (struct warning_sentinel): New.
    (tsubst_copy_and_build): Use it instead of
    c_inhibit_evaluation_warnings.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wsign-compare-7.C
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/g++.dg/cilk-plus/AN/array_test2_tplt.cc
    trunk/gcc/testsuite/g++.dg/cpp0x/overflow1.C


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

* [Bug c++/59231] [4.8/4.9 Regression] gcc misses [-Werror=sign-compare] when inside a template
  2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
                   ` (9 preceding siblings ...)
  2014-02-26 21:28 ` jason at gcc dot gnu.org
@ 2014-02-26 21:34 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-26 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.8.3                       |4.9.0

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.9.


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

end of thread, other threads:[~2014-02-26 21:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21 12:43 [Bug c++/59231] New: gcc misses [-Werror=sign-compare] when inside a template a_mcgurn at yahoo dot co.uk
2013-11-21 13:03 ` [Bug c++/59231] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-11-21 13:05 ` rguenth at gcc dot gnu.org
2013-11-21 15:06 ` rguenth at gcc dot gnu.org
2013-12-03 15:16 ` jakub at gcc dot gnu.org
2013-12-03 16:07 ` manu at gcc dot gnu.org
2014-01-24 18:21 ` jason at gcc dot gnu.org
2014-01-24 19:36 ` paolo.carlini at oracle dot com
2014-01-27 14:54 ` jason at gcc dot gnu.org
2014-02-26 18:50 ` jason at gcc dot gnu.org
2014-02-26 21:28 ` jason at gcc dot gnu.org
2014-02-26 21:34 ` jason 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).