public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60765] New: Function attributes ignored for pointer-to-member-function parameters
@ 2014-04-04 23:11 patrick at parcs dot ath.cx
  2014-04-04 23:18 ` [Bug c++/60765] " patrick at parcs dot ath.cx
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-04-04 23:11 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: 3574 bytes --]

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

            Bug ID: 60765
           Summary: Function attributes ignored for
                    pointer-to-member-function parameters
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at parcs dot ath.cx

$ cat this.cc
struct Foo;

void foo (int& (Foo::*) () __attribute__ ((returns_nonnull)));
$ g++ this.cc -c
this.cc:4:55: warning: ‘returns_nonnull’ attribute directive ignored
[-Wattributes]
 foo (int& (Foo::*) () __attribute__ ((returns_nonnull)));
                                                       ^
>From gcc-bugs-return-448342-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 04 23:12:53 2014
Return-Path: <gcc-bugs-return-448342-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11797 invoked by alias); 4 Apr 2014 23:12:52 -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 11765 invoked by uid 48); 4 Apr 2014 23:12:48 -0000
From: "mirzayanovmr at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/60766] New: Wrong optimization with -O2
Date: Fri, 04 Apr 2014 23:12: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.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: mirzayanovmr 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 attachments.created
Message-ID: <bug-60766-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-04/txt/msg00362.txt.bz2
Content-length: 986

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

            Bug ID: 60766
           Summary: Wrong optimization with -O2
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mirzayanovmr at gmail dot com

Created attachment 32546
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2546&actioníit
Compile with -O2 and input 9

Compile the following code with -O2:

~~~~~
#include <cstdlib>
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
    int n;
    cin >> n;

    for (int x = 0; x <= n; x++) {
        if (n == x + (x + 1) + (x + 2)) {
            cout << x + 2 << " " << x + 1 << " " << x << endl;
            exit(0);
        }
    }
    cout << -1 << endl;
    return 0;
}
~~~~~

Start binary and enter 9

It will print "-1", but expected output is "4 3 2".


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

* [Bug c++/60765] Function attributes ignored for pointer-to-member-function parameters
  2014-04-04 23:11 [Bug c++/60765] New: Function attributes ignored for pointer-to-member-function parameters patrick at parcs dot ath.cx
@ 2014-04-04 23:18 ` patrick at parcs dot ath.cx
  2014-04-04 23:23 ` patrick at parcs dot ath.cx
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-04-04 23:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from patrick at parcs dot ath.cx ---
Oops, that warning is because I am currently compiling with G++ 4.8, which
doesn't implement returns_nonnull.  Here's a better test case:

$ cat this.cc
struct Foo;

void foo (void (Foo::*) () __attribute__ ((nonnull)));
void bar (void (*) () __attribute__ ((nonnull)));

$ g++ this.cc c
this.cc:3:52: warning: ‘nonnull’ attribute only applies to function types
[-Wattributes]
 void foo (void (Foo::*) () __attribute__ ((nonnull)));
                                                    ^
>From gcc-bugs-return-448345-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 04 23:23:30 2014
Return-Path: <gcc-bugs-return-448345-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16630 invoked by alias); 4 Apr 2014 23:23: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 16615 invoked by uid 48); 4 Apr 2014 23:23:26 -0000
From: "patrick at parcs dot ath.cx" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60764] Bogus -Wnonnull warning against constructors declared with __attribute__ ((nonnull(1)))
Date: Fri, 04 Apr 2014 23:23: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:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: patrick at parcs dot ath.cx
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:
Message-ID: <bug-60764-4-XvjCHMfOTx@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60764-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60764-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-04/txt/msg00365.txt.bz2
Content-length: 132

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

--- Comment #1 from patrick at parcs dot ath.cx ---
I will try to resolve this.


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

* [Bug c++/60765] Function attributes ignored for pointer-to-member-function parameters
  2014-04-04 23:11 [Bug c++/60765] New: Function attributes ignored for pointer-to-member-function parameters patrick at parcs dot ath.cx
  2014-04-04 23:18 ` [Bug c++/60765] " patrick at parcs dot ath.cx
@ 2014-04-04 23:23 ` patrick at parcs dot ath.cx
  2014-04-16 20:18 ` paolo at gcc dot gnu.org
  2014-04-16 20:19 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-04-04 23:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from patrick at parcs dot ath.cx ---
I will try to resolve this.


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

* [Bug c++/60765] Function attributes ignored for pointer-to-member-function parameters
  2014-04-04 23:11 [Bug c++/60765] New: Function attributes ignored for pointer-to-member-function parameters patrick at parcs dot ath.cx
  2014-04-04 23:18 ` [Bug c++/60765] " patrick at parcs dot ath.cx
  2014-04-04 23:23 ` patrick at parcs dot ath.cx
@ 2014-04-16 20:18 ` paolo at gcc dot gnu.org
  2014-04-16 20:19 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-04-16 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Apr 16 20:17:46 2014
New Revision: 209447

URL: http://gcc.gnu.org/viewcvs?rev=209447&root=gcc&view=rev
Log:
2014-04-16  Patrick Palka  <patrick@parcs.ath.cx>

    PR c++/60765
    * decl2.c (cplus_decl_attributes): Handle
    pointer-to-member-function declarations.

2014-04-16  Patrick Palka  <patrick@parcs.ath.cx>

    PR c++/60764
    * call.c (build_user_type_coversion): Use build_dummy_object
    to create the placeholder object for a constructor method call.
    (build_special_member_call): Likewise.
    (build_over_call): Check for the placeholder object with
    is_dummy_object.
    (build_new_method_call_1): Likewise.  Don't attempt to resolve
    a dummy object for a constructor method call.

Added:
    trunk/gcc/testsuite/g++.dg/ext/attrib49.C
    trunk/gcc/testsuite/g++.dg/warn/nonnull2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/g++.dg/cpp0x/gen-attrs-36-1.C


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

* [Bug c++/60765] Function attributes ignored for pointer-to-member-function parameters
  2014-04-04 23:11 [Bug c++/60765] New: Function attributes ignored for pointer-to-member-function parameters patrick at parcs dot ath.cx
                   ` (2 preceding siblings ...)
  2014-04-16 20:18 ` paolo at gcc dot gnu.org
@ 2014-04-16 20:19 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-16 20:19 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.10.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed.


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

end of thread, other threads:[~2014-04-16 20:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04 23:11 [Bug c++/60765] New: Function attributes ignored for pointer-to-member-function parameters patrick at parcs dot ath.cx
2014-04-04 23:18 ` [Bug c++/60765] " patrick at parcs dot ath.cx
2014-04-04 23:23 ` patrick at parcs dot ath.cx
2014-04-16 20:18 ` paolo at gcc dot gnu.org
2014-04-16 20:19 ` paolo.carlini at oracle dot com

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).