public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58362] New: Wrong column number for unused parameter
@ 2013-09-08 13:26 glisse at gcc dot gnu.org
  2013-09-08 14:04 ` [Bug c++/58362] " paolo.carlini at oracle dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-08 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58362
           Summary: Wrong column number for unused parameter
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

void f (long s) { }

y.cc:1:6: warning: unused parameter 's' [-Wunused-parameter]
 void f (long s) { }
      ^

Note the column information, which should point to s instead.
I tried the following:

--- function.c    (revision 202365)
+++ function.c    (working copy)
@@ -4997,21 +4997,22 @@ use_return_register (void)
 void
 do_warn_unused_parameter (tree fn)
 {
   tree decl;

   for (decl = DECL_ARGUMENTS (fn);
        decl; decl = DECL_CHAIN (decl))
     if (!TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
     && DECL_NAME (decl) && !DECL_ARTIFICIAL (decl)
     && !TREE_NO_WARNING (decl))
-      warning (OPT_Wunused_parameter, "unused parameter %q+D", decl);
+      warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_parameter,
+          "unused parameter %q+D", decl);
 }

 /* Generate RTL for the end of the current function.  */

 void
 expand_function_end (void)
 {
   rtx clobber_after;

   /* If arg_pointer_save_area was referenced only from a nested

And I checked in gdb, the first argument of warning_at has the right column
information, but it is ignored :-(


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
@ 2013-09-08 14:04 ` paolo.carlini at oracle dot com
  2013-09-08 14:08 ` glisse at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-08 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Maybe it's just me, but I don't understand what -ignored- means in this
context, could you please explain?


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
  2013-09-08 14:04 ` [Bug c++/58362] " paolo.carlini at oracle dot com
@ 2013-09-08 14:08 ` glisse at gcc dot gnu.org
  2013-09-08 14:19 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-08 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #1)
> Maybe it's just me, but I don't understand what -ignored- means in this
> context, could you please explain?

It means that the diagnostic machinery takes the column information from
somewhere else (I didn't really understand where) instead of using the one from
the loc parameter.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
  2013-09-08 14:04 ` [Bug c++/58362] " paolo.carlini at oracle dot com
  2013-09-08 14:08 ` glisse at gcc dot gnu.org
@ 2013-09-08 14:19 ` paolo.carlini at oracle dot com
  2013-09-08 16:26 ` manu at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-08 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Oh I see, but that should be rather easy to track down.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-09-08 14:19 ` paolo.carlini at oracle dot com
@ 2013-09-08 16:26 ` manu at gcc dot gnu.org
  2013-09-08 16:41 ` glisse at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu.org @ 2013-09-08 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #4)
> The damage happens at error.c:3435. Should we just use "%qD", no '+' ?

Yes. And this is the reason I am against the magic +/# for location info.
Unless you know (and keep remembering) the diagnostic machinery very well, the
+ doesn't mean anything and it is easy to miss, whereas
"warning_at(DECL_SOURCE_LOCATION(decl)" seems pretty self-evident to me.
>From gcc-bugs-return-429270-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Sep 08 16:34:50 2013
Return-Path: <gcc-bugs-return-429270-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4425 invoked by alias); 8 Sep 2013 16:34:50 -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 4374 invoked by uid 48); 8 Sep 2013 16:34:47 -0000
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/58340] [4.9 regression] gcc/cp/pt.c:7064:1: internal compiler error: in propagate_threaded_block_debug_into, at tree-ssa-threadedge.c:623
Date: Sun, 08 Sep 2013 16:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: blocker
X-Bugzilla-Who: law at redhat dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58340-4-sxU7MSYZ97@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58340-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58340-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-09/txt/msg00510.txt.bz2
Content-length: 353

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

--- Comment #16 from Jeffrey A. Law <law at redhat dot com> ---
Jan's patch papers over the problem of incorrect initialization of "found".  I
expect to be able to run through the formalities necessary to install the fix
tonight.

Reverting until I take care of things tonight is the better option.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-09-08 16:26 ` manu at gcc dot gnu.org
@ 2013-09-08 16:41 ` glisse at gcc dot gnu.org
  2013-09-08 16:53 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-08 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #4)
> The damage happens at error.c:3435.

Yes, location_of replaces the declaration of the argument with that of the
function :-(

> Should we just use "%qD", no '+' ?

I don't think I ever understood what '+' meant, or found the relevant doc. But
the comment in front of location_of seems to agree with your solution. And
indeed it works.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-09-08 16:41 ` glisse at gcc dot gnu.org
@ 2013-09-08 16:53 ` paolo.carlini at oracle dot com
  2013-09-08 16:54 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-08 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-08
     Ever confirmed|0                           |1

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Testing of C++ succeeded. I will test C too and in case will submit. I guess
Honza can approve the patch.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-09-08 16:53 ` paolo.carlini at oracle dot com
@ 2013-09-08 16:54 ` paolo.carlini at oracle dot com
  2013-09-09 10:47 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-08 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at ucw dot cz

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Honza can you review gcc/function.c changes?


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-09-08 16:54 ` paolo.carlini at oracle dot com
@ 2013-09-09 10:47 ` paolo.carlini at oracle dot com
  2013-09-09 10:51 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-09 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I sent the simple patch and apparently people would rather prefer fixing
location_of to not do t = DECL_CONTEXT (t) for PARM_DECLs, likewise the C
front-end of course, in such a way that '+' works and we don't have to pass the
DECL_SOURCE_LOCATION. I can't work on this right now.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2013-09-09 10:47 ` paolo.carlini at oracle dot com
@ 2013-09-09 10:51 ` paolo.carlini at oracle dot com
  2013-09-09 11:06 ` paolo.carlini at oracle dot com
  2013-09-09 13:40 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-09 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Nope, sorry, the C front-end is already fine, thus I guess we really want to
change location_of in the C++ front-end.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2013-09-09 10:51 ` paolo.carlini at oracle dot com
@ 2013-09-09 11:06 ` paolo.carlini at oracle dot com
  2013-09-09 13:40 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-09 11:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|hubicka at ucw dot cz              |
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ok, that's doable.


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

* [Bug c++/58362] Wrong column number for unused parameter
  2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2013-09-09 11:06 ` paolo.carlini at oracle dot com
@ 2013-09-09 13:40 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-09 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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


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

end of thread, other threads:[~2013-09-09 13:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-08 13:26 [Bug c++/58362] New: Wrong column number for unused parameter glisse at gcc dot gnu.org
2013-09-08 14:04 ` [Bug c++/58362] " paolo.carlini at oracle dot com
2013-09-08 14:08 ` glisse at gcc dot gnu.org
2013-09-08 14:19 ` paolo.carlini at oracle dot com
2013-09-08 16:26 ` manu at gcc dot gnu.org
2013-09-08 16:41 ` glisse at gcc dot gnu.org
2013-09-08 16:53 ` paolo.carlini at oracle dot com
2013-09-08 16:54 ` paolo.carlini at oracle dot com
2013-09-09 10:47 ` paolo.carlini at oracle dot com
2013-09-09 10:51 ` paolo.carlini at oracle dot com
2013-09-09 11:06 ` paolo.carlini at oracle dot com
2013-09-09 13:40 ` 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).