public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60018] New: Bogus conversion warning with optimization flag -O1
@ 2014-02-01  6:08 chengniansun at gmail dot com
  2014-02-03 12:18 ` [Bug c/60018] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: chengniansun at gmail dot com @ 2014-02-01  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60018
           Summary: Bogus conversion warning with optimization flag -O1
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

The -Wconversion should not be affected by the optimization flags. 

For the following code, Gcc emits no warning with flag -O0, but one conversion
warning with flag -O1. 



$: cat s.c
extern void fn1(unsigned);
extern void fn3(void);
void fn2(void);
void fn2() {
  fn1((fn3(), 0) || 0);
}
$: gcc-trunk -c -Wconversion -std=c11 -O0 s.c
$: gcc-trunk -c -Wconversion -std=c11 -O1 s.c
s.c: In function ‘fn2’:
s.c:5:7: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign
of the result [-Wsign-conversion]
   fn1((fn3(), 0) || 0);
       ^
$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/chengniansun/tools/gcc-trunk-binaries/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries :
(reconfigured) ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries :
(reconfigured) ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries
Thread model: posix
gcc version 4.9.0 20140131 (experimental) (GCC)
>From gcc-bugs-return-442253-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Feb 01 06:20:58 2014
Return-Path: <gcc-bugs-return-442253-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3561 invoked by alias); 1 Feb 2014 06:20:57 -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 3536 invoked by uid 48); 1 Feb 2014 06:20:53 -0000
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60019] New: [C++11] Bogus error: use of deleted function unique_ptr(const unique_ptr&)
Date: Sat, 01 Feb 2014 06:20: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ppluzhnikov at google dot com
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-60019-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: 2014-02/txt/msg00010.txt.bz2
Content-length: 1858

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

            Bug ID: 60019
           Summary: [C++11] Bogus error: use of deleted function
                    unique_ptr(const unique_ptr&)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/12846752

Test:

#include <memory>
struct S {};
struct T : S {};

std::unique_ptr<T> F();
const std::unique_ptr<S> s = F();


Using recent trunk:
g++ (GCC) 4.9.0 20140129 (experimental)

t.cc:6:32: error: use of deleted function ‘std::unique_ptr<_Tp,
_Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = S; _Dp =
std::default_delete<S>]’
 const std::unique_ptr<S> s = F();
                                ^


There is a copy constructor in unique_ptr.h that
I believe is supposed to apply here:

      /** @brief Converting constructor from another type
       *
       * Requires that the pointer owned by @p __u is convertible to the
       * type of pointer owned by this object, @p __u does not own an array,
       * and @p __u has a compatible deleter type.
       */
      template<typename _Up, typename _Ep, typename = _Require<
               is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>,
               __not_<is_array<_Up>>,
               typename conditional<is_reference<_Dp>::value,
                                    is_same<_Ep, _Dp>,
                                    is_convertible<_Ep, _Dp>>::type>>
        unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
        : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
        { }

but for some reason it doesn't kick in.

(Code builds fine under Clang.)
>From gcc-bugs-return-442254-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Feb 01 07:13:37 2014
Return-Path: <gcc-bugs-return-442254-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20260 invoked by alias); 1 Feb 2014 07:13: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 20239 invoked by uid 48); 1 Feb 2014 07:13:32 -0000
From: "lanxingcan at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/60020] New: Considering backport regexp support to 4.8+
Date: Sat, 01 Feb 2014 07:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: lanxingcan at gmail dot com
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-60020-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-02/txt/msg00011.txt.bz2
Content-length: 611

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`020

            Bug ID: 60020
           Summary: Considering backport regexp support to 4.8+
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lanxingcan at gmail dot com

As GCC 4.8.1+ is already C++11 languages feature complete, it's pity that
regex, a major part of C++11 library feature does not supported in 4.8.x
serials. Any plan on backport regexp support to GCC 4.8.x?


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

* [Bug c/60018] Bogus conversion warning with optimization flag -O1
  2014-02-01  6:08 [Bug c/60018] New: Bogus conversion warning with optimization flag -O1 chengniansun at gmail dot com
@ 2014-02-03 12:18 ` mpolacek at gcc dot gnu.org
  2014-02-03 16:48 ` mpolacek at gcc dot gnu.org
  2014-03-28 10:18 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-03 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-02-03
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, not a regression.


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

* [Bug c/60018] Bogus conversion warning with optimization flag -O1
  2014-02-01  6:08 [Bug c/60018] New: Bogus conversion warning with optimization flag -O1 chengniansun at gmail dot com
  2014-02-03 12:18 ` [Bug c/60018] " mpolacek at gcc dot gnu.org
@ 2014-02-03 16:48 ` mpolacek at gcc dot gnu.org
  2014-03-28 10:18 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-03 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The issue is that at -O0 conversion_warning gets (fn3(), 0) || 0 and doesn't
call unsafe_conversion_p on it, while on -O fold_binary folds away the || 0
part and conversion_warning sees COMPOUND_EXPR, it then calls
unsafe_conversion_p on it.

I guess nothing for 4.9 now we're in stage4.


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

* [Bug c/60018] Bogus conversion warning with optimization flag -O1
  2014-02-01  6:08 [Bug c/60018] New: Bogus conversion warning with optimization flag -O1 chengniansun at gmail dot com
  2014-02-03 12:18 ` [Bug c/60018] " mpolacek at gcc dot gnu.org
  2014-02-03 16:48 ` mpolacek at gcc dot gnu.org
@ 2014-03-28 10:18 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2014-03-28 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> The issue is that at -O0 conversion_warning gets (fn3(), 0) || 0 and doesn't
> call unsafe_conversion_p on it, while on -O fold_binary folds away the || 0
> part and conversion_warning sees COMPOUND_EXPR, it then calls
> unsafe_conversion_p on it.

But in any case, it should look to the last operand of (... , ...) and see that
it is a constant 0. I think there is a duplicate already about -Wconversion not
recursing into compound expressions.
>From gcc-bugs-return-447698-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 28 10:26:17 2014
Return-Path: <gcc-bugs-return-447698-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1575 invoked by alias); 28 Mar 2014 10:26:17 -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 1503 invoked by uid 55); 28 Mar 2014 10:26:12 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/60315] [4.8/4.9 Regression] template constructor switch optimization
Date: Fri, 28 Mar 2014 10:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords: compile-time-hog
X-Bugzilla-Severity: minor
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60315-4-xqaSGHMJW5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60315-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60315-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-03/txt/msg02567.txt.bz2
Content-length: 424

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`315

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Mar 28 10:25:34 2014
New Revision: 208893

URL: http://gcc.gnu.org/viewcvs?rev 8893&root=gcc&view=rev
Log:
    PR ipa/60315
    * g++.dg/torture/pr60315.C: Add -std=c++11 to dg-options.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/torture/pr60315.C


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

end of thread, other threads:[~2014-03-28 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-01  6:08 [Bug c/60018] New: Bogus conversion warning with optimization flag -O1 chengniansun at gmail dot com
2014-02-03 12:18 ` [Bug c/60018] " mpolacek at gcc dot gnu.org
2014-02-03 16:48 ` mpolacek at gcc dot gnu.org
2014-03-28 10:18 ` manu 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).