public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eric.niebler at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59244] New: [c++11] can't specialize template on ref-qualified member function pointer type
Date: Fri, 22 Nov 2013 05:41:00 -0000	[thread overview]
Message-ID: <bug-59244-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 59244
           Summary: [c++11] can't specialize template on ref-qualified
                    member function pointer type
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com

I believe the following should compile:

```
template<typename T>
struct U;

template<typename S, typename T>
struct U<S (T::*)()>
{};

template<typename S, typename T>
struct U<S (T::*)() &>
{};

template<typename S, typename T>
struct U<S (T::*)() &&>
{};
```

g++ 4.8.1 in C++11 mode gives this:

```
test.cpp:9:8: error: redefinition of ‘struct U<S (T::*)()>’
 struct U<S (T::*)() &>
        ^
test.cpp:5:8: error: previous definition of ‘struct U<S (T::*)()>’
 struct U<S (T::*)()>
        ^
test.cpp:13:8: error: redefinition of ‘struct U<S (T::*)()>’
 struct U<S (T::*)() &&>
        ^
test.cpp:5:8: error: previous definition of ‘struct U<S (T::*)()>’
 struct U<S (T::*)()>
        ^
```
>From gcc-bugs-return-435474-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 22 06:53:31 2013
Return-Path: <gcc-bugs-return-435474-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23945 invoked by alias); 22 Nov 2013 06:53:30 -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 23922 invoked by uid 48); 22 Nov 2013 06:53:25 -0000
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59245] New: ICE on valid code at -O3 on x86_64-linux-gnu in set_value_range, at tree-vrp.c:443
Date: Fri, 22 Nov 2013 06:53: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.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: su at cs dot ucdavis.edu
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-59245-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/msg02251.txt.bz2
Content-length: 2611

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

            Bug ID: 59245
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu in
                    set_value_range, at tree-vrp.c:443
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes an ICE when compiled with the current gcc trunk at
-O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes). 

This is a regression from 4.8.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20131121 (experimental) [trunk revision 205234] (GCC) 
$ 
$ gcc-trunk -O2 -c small.c
$ gcc-4.8.2 -O3 -c small.c
$
$ gcc-trunk -O3 -c small.c
small.c: In function ‘fn2’:
small.c:18:1: internal compiler error: in set_value_range, at tree-vrp.c:443
 fn2 ()
 ^
0xba89bc set_value_range
    ../../gcc-trunk/gcc/tree-vrp.c:443
0xbb913a extract_range_from_assert
    ../../gcc-trunk/gcc/tree-vrp.c:1749
0xbb913a extract_range_from_assignment
    ../../gcc-trunk/gcc/tree-vrp.c:3772
0xbba671 vrp_visit_assignment_or_call
    ../../gcc-trunk/gcc/tree-vrp.c:6742
0xbba671 vrp_visit_stmt
    ../../gcc-trunk/gcc/tree-vrp.c:7553
0xb00612 simulate_stmt
    ../../gcc-trunk/gcc/tree-ssa-propagate.c:324
0xb00bfd simulate_block
    ../../gcc-trunk/gcc/tree-ssa-propagate.c:447
0xb00bfd ssa_propagate(ssa_prop_result (*)(gimple_statement_base*, edge_def**,
tree_node**), ssa_prop_result (*)(gimple_statement_base*))
    ../../gcc-trunk/gcc/tree-ssa-propagate.c:854
0xbbb66b execute_vrp
    ../../gcc-trunk/gcc/tree-vrp.c:9710
0xbbb66b execute
    ../../gcc-trunk/gcc/tree-vrp.c:9801
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.
$ 

----------------------------------------

int a, b, c, e, g;
char d[5], f;

int
fn1 ()
{
  if (b)
    {
      g = 0;
      return 0;
    }
  for (f = 0; f != 1; f--)
    ;
  return 0;
}

void
fn2 ()
{
  d[4] = -1;
  for (a = 4; a; a--)
    {
      fn1 ();
      e = c < -2147483647 - 1 - d[a] ? c : 0;
    }
}
>From gcc-bugs-return-435475-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 22 06:55:04 2013
Return-Path: <gcc-bugs-return-435475-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25522 invoked by alias); 22 Nov 2013 06:55: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 25122 invoked by uid 48); 22 Nov 2013 06:55:00 -0000
From: "boostcpp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59246] New: GCC should issue runtime error for calling pure virtual function with definition
Date: Fri, 22 Nov 2013 06:55: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.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: boostcpp 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-59246-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/msg02252.txt.bz2
Content-length: 1061

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

            Bug ID: 59246
           Summary: GCC should issue runtime error for calling pure
                    virtual function with definition
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boostcpp at gmail dot com

Consider the following code:

struct Base
{
    virtual void f() = 0 ;
    virtual ~Base() ;
} ;

// pure virtual function with definition
void Base::f() { }

Base::~Base()
{
// call by unqualified name is virtual function call.
// virtual function call during destruction is undefined.
    f() ;
}

GCC does not issue runtime abort for a virtual function that also has
definition.
According to the standard(10.4 paragraph 6), this is undefined.
Since this is undefined, GCC can do anything.

But I think GCC should issue runtime abort if it is technically possible.
Clang issues runtime abort for this code.


             reply	other threads:[~2013-11-22  5:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22  5:41 eric.niebler at gmail dot com [this message]
2013-11-23 22:19 ` [Bug c++/59244] " daniel.kruegler at googlemail dot com
2014-11-26 16:20 ` paolo.carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-59244-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).