public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56723] New: wrong location in error message
@ 2013-03-25 18:40 tromey at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: tromey at gcc dot gnu.org @ 2013-03-25 18:40 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56723
           Summary: wrong location in error message
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


Consider this source file:

int f (int *);

int callf (int, int, int (*)(double *));

int docall(void)
{
  return callf (23, 72,
        f);
}


Compiling this with g++ yields:

t.cc: In function ‘int docall()’:
t.cc:8:4: error: invalid conversion from ‘int (*)(int*)’ to ‘int (*)(double*)’
[-fpermissive]
   f);
    ^
t.cc:3:5: error:   initializing argument 3 of ‘int callf(int, int, int
(*)(double*))’ [-fpermissive]
 int callf (int, int, int (*)(double *));
     ^


Note that "8:4" location.
I think this is slightly off.

The C compiler gets it ok:

barimba. gcc -g --syntax-only t.c
t.c: In function ‘docall’:
t.c:8:3: warning: passing argument 3 of ‘callf’ from incompatible pointer type
[enabled by default]
(etc)
>From gcc-bugs-return-418375-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Mar 25 18:43:28 2013
Return-Path: <gcc-bugs-return-418375-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3454 invoked by alias); 25 Mar 2013 18:43:28 -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 3423 invoked by uid 48); 25 Mar 2013 18:43:20 -0000
From: "tromey at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/56724] New: sub-optimal location in error
Date: Mon, 25 Mar 2013 18:43: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-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tromey 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-Changed-Fields:
Message-ID: <bug-56724-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg01816.txt.bz2
Content-length: 1114


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

             Bug #: 56724
           Summary: sub-optimal location in error
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


Consider this source:

int f (int *);

int callf (int, int, int (*)(double *));

int docall(void)
{
  return callf (23, 72,
        f);
}


Compiling this, I get:

t.c: In function ‘docall’:
t.c:8:3: warning: passing argument 3 of ‘callf’ from incompatible pointer type
[enabled by default]
   f);
   ^
t.c:3:5: note: expected ‘int (*)(double *)’ but argument is of type ‘int
(*)(int *)’
 int callf (int, int, int (*)(double *));
     ^


I think the location "3:5" is not ideal.
It would be better, at least IMO, if it pointed to the particular
parameter in the declaration.
If you have many parameters, it can be hard to find the right one.
>From gcc-bugs-return-418376-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Mar 25 18:44:29 2013
Return-Path: <gcc-bugs-return-418376-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4207 invoked by alias); 25 Mar 2013 18:44:28 -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 4153 invoked by uid 48); 25 Mar 2013 18:44:21 -0000
From: "tromey at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/56725] New: extra spaces in error message
Date: Mon, 25 Mar 2013 18:44: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-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tromey 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-Changed-Fields:
Message-ID: <bug-56725-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg01817.txt.bz2
Content-length: 1048


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

             Bug #: 56725
           Summary: extra spaces in error message
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


Consider this source:

int f (int *);

int callf (int, int, int (*)(double *));

int docall(void)
{
  return callf (23, 72,
        f);
}


If I compile this with g++ I get:

t.c: In function ‘int docall()’:
t.c:8:4: error: invalid conversion from ‘int (*)(int*)’ to ‘int (*)(double*)’
[-fpermissive]
   f);
    ^
t.c:3:5: error:   initializing argument 3 of ‘int callf(int, int, int
(*)(double*))’ [-fpermissive]
 int callf (int, int, int (*)(double *));
     ^
You have mail in /var/spool/mail/tromey


Note the extra spaces before "initializing".
This looked weird to me.
>From gcc-bugs-return-418377-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Mar 25 18:44:42 2013
Return-Path: <gcc-bugs-return-418377-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4910 invoked by alias); 25 Mar 2013 18:44:42 -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 4730 invoked by uid 48); 25 Mar 2013 18:44:37 -0000
From: "tromey at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/56724] sub-optimal location in error
Date: Mon, 25 Mar 2013 18:44: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-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tromey 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-Changed-Fields:
Message-ID: <bug-56724-4-ialFT7rfe6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56724-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56724-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg01818.txt.bz2
Content-length: 170


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

--- Comment #1 from Tom Tromey <tromey at gcc dot gnu.org> 2013-03-25 18:44:37 UTC ---
This affects g++ as well.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-25 18:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 18:40 [Bug c++/56723] New: wrong location in error message tromey at gcc dot gnu.org

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