public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57709] -Wshadow is too strict / has false positives
Date: Tue, 25 Jun 2013 16:46:00 -0000	[thread overview]
Message-ID: <bug-57709-4-CS3h0WpqSY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57709-4@http.gcc.gnu.org/bugzilla/>

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

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

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

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> > clang does no warn on "var_and_method" as variable vs. method are safe, if one
> > tries to use them inappropriately one gets an error.
> 
> Not always.  Think of function pointers or pointer to member functions. 
> clang is not loose in my mind rather than GCC is too strict.

In GCC 4.8 I implemented:

"The option -Wshadow no longer warns if a declaration shadows a function
declaration, unless the former declares a function or pointer to function,
because this is a common and valid case in real-world code."

I think this is a useful heuristic also for member functions, no? I don't have
time to work on this at the moment, but it would be useful to know whether the
maintainers agree, so someone (Jan?) may start working on a patch.
>From gcc-bugs-return-425097-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 25 16:51:54 2013
Return-Path: <gcc-bugs-return-425097-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7628 invoked by alias); 25 Jun 2013 16:51:54 -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 7566 invoked by uid 48); 25 Jun 2013 16:51:50 -0000
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57709] -Wshadow is too strict / has false positives
Date: Tue, 25 Jun 2013 16:51: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: enhancement
X-Bugzilla-Who: jason at gcc dot gnu.org
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_severity
Message-ID: <bug-57709-4-6dTf4lD4mI@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57709-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57709-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-06/txt/msg01476.txt.bz2
Content-length: 1079

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #4)
> "The option -Wshadow no longer warns if a declaration shadows a function
> declaration, unless the former declares a function or pointer to function,
> because this is a common and valid case in real-world code."
> 
> I think this is a useful heuristic also for member functions, no? I don't
> have time to work on this at the moment, but it would be useful to know
> whether the maintainers agree, so someone (Jan?) may start working on a
> patch.

That would be fine.  But it seems less important for member functions, since
there's much less chance of a local variable name conflicting with some random
function declared by an #include file.
>From gcc-bugs-return-425098-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 25 16:59:33 2013
Return-Path: <gcc-bugs-return-425098-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14311 invoked by alias); 25 Jun 2013 16:59:33 -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 14251 invoked by uid 48); 25 Jun 2013 16:59:24 -0000
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57710] New: [OOP] _vptr not set for allocatable CLASS components
Date: Tue, 25 Jun 2013 16:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-valid-code, wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: burnus at gcc dot gnu.org
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 keywords bug_severity priority component assigned_to reporter
Message-ID: <bug-57710-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-06/txt/msg01477.txt.bz2
Content-length: 1324

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

            Bug ID: 57710
           Summary: [OOP] _vptr not set for allocatable CLASS components
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

The following code (minus the IF condition) shows that _vptr is not set for the
allocatable component:
        y.x._data = 0B;
there should be - but isn't - additionally: y.x._vptr = &__vtab_m_T;


Additionally, the test case as is (with IF condition), currently crashes with:

internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.c:1654
   if (.not. same_type_as(y%x, z)) call abort ()
 ^
0x632ce2 gfc_conv_component_ref
        ../../gcc/fortran/trans-expr.c:1654
0x63fc89 gfc_conv_variable
        ../../gcc/fortran/trans-expr.c:1921


module m
  type t
  end type t
  type t2
    integer :: ii
    class(t), allocatable :: x
  end type t2
contains
  subroutine fini(x)
     type(t) :: x
  end subroutine fini
end module m

use m
block
  type(t) :: z
  type(t2) :: y
  y%ii = 123
  if (.not. same_type_as(y%x, z)) call abort ()
end block
end


  parent reply	other threads:[~2013-06-25 16:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 13:52 [Bug c++/57709] New: " jan.kratochvil at redhat dot com
2013-06-25 15:52 ` [Bug c++/57709] " pinskia at gcc dot gnu.org
2013-06-25 16:17 ` jakub at gcc dot gnu.org
2013-06-25 16:40 ` jan.kratochvil at redhat dot com
2013-06-25 16:46 ` manu at gcc dot gnu.org [this message]
2013-06-25 18:00 ` manu at gcc dot gnu.org
2013-11-19  6:31 ` manu at gcc dot gnu.org
2013-11-19 13:40 ` jan.kratochvil at redhat dot com
2013-11-19 16:49 ` manu at gcc dot gnu.org
2013-11-19 17:15 ` jan.kratochvil at redhat dot com
2013-12-14  7:57 ` jan.kratochvil at redhat dot com
2013-12-17 22:35 ` joseph at codesourcery dot com
2014-08-22 19:13 ` manu at gcc dot gnu.org
2015-06-09  9:33 ` gael.guennebaud at gmail dot com
2015-06-09  9:47 ` manu at gcc dot gnu.org

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-57709-4-CS3h0WpqSY@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).