From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14826 invoked by alias); 6 Jun 2013 17:54:48 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14732 invoked by uid 48); 6 Jun 2013 17:54:43 -0000 From: "mib.bugzilla at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57546] New: templated gnu multiversion function pointer returns wrong value Date: Thu, 06 Jun 2013 17:54: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: mib.bugzilla 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: 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-06/txt/msg00303.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57546 Bug ID: 57546 Summary: templated gnu multiversion function pointer returns wrong value Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mib.bugzilla at gmail dot com /rdrive/ref/gcc/bin/g++48 fum.cpp -std=c++0x -bash-4.1$ ./a.out FAILED i:0 j:0x80499c6 -bash-4.1$ cat fum.cpp template class Foo { public: /* Default version of foo. */ __attribute__ ((target("default"))) T foo () { return 0; } /* corei7 version of foo. */ __attribute__ ((target("arch=corei7"))) T foo () { return 0; } T (Foo::*p)() = &Foo::foo; // pointer to member }; #include int main () { Foo f; int i = f.foo(); int j = (f.*(f.p))(); // pointer to member call if (i==j && j==0) { printf("PASSED\n"); return 0; } else { printf("FAILED i:%d j:0x%x\n", i, j); return -1; } } -bash-4.1$ /rdrive/ref/gcc/bin/g++48 -v Using built-in specs. COLLECT_GCC=/rdrive/ref/gcc/4.8.1/rhel60/x86/bin/g++ COLLECT_LTO_WRAPPER=/site/spt/rdrive/ref/gcc/4.8.1/rhel60/x86/bin/../libexec/gcc/i686-pc-linux-gnu/4.8.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: /rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/configure --prefix=/rdrive/ref/gcc/4.8.1/rhel60/x86 --enable-languages=c,c++,objc,fortran --disable-multilib --target=i686-pc-linux-gnu --disable-bootstrap --enable-decimal-float --with-gmp=/rusers/sys_cron/grab_gcc/downloads_rel/lib/x86 --with-mpfr=/rusers/sys_cron/grab_gcc/downloads_rel/lib/x86 --with-mpc=/rusers/sys_cron/grab_gcc/downloads_rel/lib/x86 Thread model: posix gcc version 4.8.1 (GCC)