public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/61165] New: unfriendly diagnostic from macro expansion
@ 2014-05-13  6:40 tromey at gcc dot gnu.org
  2014-05-13  9:47 ` [Bug c/61165] bad location for conversion in return manu at gcc dot gnu.org
  2014-05-13 15:53 ` tromey at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tromey at gcc dot gnu.org @ 2014-05-13  6:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165

            Bug ID: 61165
           Summary: unfriendly diagnostic from macro expansion
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tromey at gcc dot gnu.org

Consider this source:

extern void *allocate (int);

#define my_alloc(X) allocate (X)

int *alloc_int(void)
{
  int *result = my_alloc(sizeof (int));
  return result;
}


Now compile with -Wc++-compat:

barimba. gcc --syntax-only -Wc++-compat r.c
r.c: In function ‘alloc_int’:
r.c:3:21: warning: request for implicit conversion from ‘void *’ to ‘int *’ not
permitted in C++ [-Wc++-compat]
 #define my_alloc(X) allocate (X)
                     ^
r.c:7:17: note: in expansion of macro ‘my_alloc’
   int *result = my_alloc(sizeof (int));
                 ^


I find this a bit strange.  The actual "warning:" line points to
the #define -- but here I think I would have expected this to
point to the call instead, with a "note:" pointing to the macro
definition.
>From gcc-bugs-return-451400-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 06:42:08 2014
Return-Path: <gcc-bugs-return-451400-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8850 invoked by alias); 13 May 2014 06:42:08 -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 8470 invoked by uid 48); 13 May 2014 06:42:02 -0000
From: "tromey at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/61165] unfriendly diagnostic from macro expansion
Date: Tue, 13 May 2014 06:42:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: unknown
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-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61165-4-r1TJXsqbjo@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61165-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61165-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: 2014-05/txt/msg01092.txt.bz2
Content-length: 627

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165

--- Comment #1 from Tom Tromey <tromey at gcc dot gnu.org> ---
Also, note what happens if one changes the body of the function:

extern void *allocate (int);

#define my_alloc(X) allocate (X)

int *alloc_int(void)
{
  return my_alloc(sizeof (int));
}


barimba. gcc --syntax-only -Wc++-compat r.c
r.c: In function ‘alloc_int’:
r.c:7:3: warning: request for implicit conversion from ‘void *’ to ‘int *’ not
permitted in C++ [-Wc++-compat]
   return my_alloc(sizeof (int));
   ^


Now there's no mention of the macro at all.
>From gcc-bugs-return-451401-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 06:44:02 2014
Return-Path: <gcc-bugs-return-451401-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10949 invoked by alias); 13 May 2014 06:44:01 -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 10908 invoked by uid 48); 13 May 2014 06:43:58 -0000
From: "swissp2013 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/60858] 64-bit multi-character constants
Date: Tue, 13 May 2014 06:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: swissp2013 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:
Message-ID: <bug-60858-4-icpT7mZ1zZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60858-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60858-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-05/txt/msg01093.txt.bz2
Content-length: 373

https://gcc.gnu.org/bugzilla/show_bug.cgi?id`858

--- Comment #2 from SwissP <swissp2013 at gmail dot com> ---
Andrew,

> Also patches go to gcc-patches@ and should include a testcase or two.

Not familiar with the bugzilla interface I could
not find where "gcc-patches@" resides on the site.

Can you give me a link to the relevant resource?

Thank you for your help!


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

* [Bug c/61165] bad location for conversion in return
  2014-05-13  6:40 [Bug preprocessor/61165] New: unfriendly diagnostic from macro expansion tromey at gcc dot gnu.org
@ 2014-05-13  9:47 ` manu at gcc dot gnu.org
  2014-05-13 15:53 ` tromey at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2014-05-13  9:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-13
                 CC|                            |manu at gcc dot gnu.org
          Component|preprocessor                |c
            Summary|unfriendly diagnostic from  |bad location for conversion
                   |macro expansion             |in return
     Ever confirmed|0                           |1

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #1)
> Now there's no mention of the macro at all.

The macro expansion note depends on the location, if the location points to
something unrelated to the macro expansion, then it cannot work.

So the problem is the location.
>From gcc-bugs-return-451426-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 09:48:00 2014
Return-Path: <gcc-bugs-return-451426-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7520 invoked by alias); 13 May 2014 09:47:59 -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 7485 invoked by uid 48); 13 May 2014 09:47:56 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/61162] possibly bad error location with -Wc++-compat
Date: Tue, 13 May 2014 09:47: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-61162-4-syQd1jrmF0@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61162-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61162-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: 2014-05/txt/msg01118.txt.bz2
Content-length: 1078

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61162

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

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

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #7)
> (In reply to Marek Polacek from comment #6)
> 
> > I'd prefer the RHS location here; it's the RHS that's being converted.
> 
> I was hoping to automate some conversion from C to C++ using
> the error locations.
> So from this perspective, something relatively consistent would be nice.
> It could be the RHS or it could be the "=", for my purposes they
> are equally good.  I tend to think of the "=" as being the "reason
> for the conversion", but I wouldn't want to make any claims for it
> beyond that.

If you point to '=', then the macro expansion note will not appear in your
other example (PR61165).
>From gcc-bugs-return-451427-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 09:49:36 2014
Return-Path: <gcc-bugs-return-451427-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9857 invoked by alias); 13 May 2014 09:49:36 -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 9832 invoked by uid 48); 13 May 2014 09:49:33 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/61165] bad location for conversion in return
Date: Tue, 13 May 2014 09:49: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
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-61165-4-fARmPh8Ciw@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61165-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61165-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: 2014-05/txt/msg01119.txt.bz2
Content-length: 516

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #0)
> 
> I find this a bit strange.  The actual "warning:" line points to
> the #define -- but here I think I would have expected this to
> point to the call instead, with a "note:" pointing to the macro
> definition.

I tend to agree on this, but unfortunately, the previous discussion on this
didn't reach any consensus. See PR52998.
>From gcc-bugs-return-451428-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 09:52:40 2014
Return-Path: <gcc-bugs-return-451428-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11404 invoked by alias); 13 May 2014 09:52:40 -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 11382 invoked by uid 48); 13 May 2014 09:52:37 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/61165] bad location for conversion in return
Date: Tue, 13 May 2014 09:52: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
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-61165-4-EB9aB8kBnb@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61165-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61165-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: 2014-05/txt/msg01120.txt.bz2
Content-length: 635

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #3)
> (In reply to Tom Tromey from comment #0)
> > 
> > I find this a bit strange.  The actual "warning:" line points to
> > the #define -- but here I think I would have expected this to
> > point to the call instead, with a "note:" pointing to the macro
> > definition.
> 
> I tend to agree on this, but unfortunately, the previous discussion on this
> didn't reach any consensus. See PR52998.

Sorry, that should be PR55252.
>From gcc-bugs-return-451429-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 09:54:59 2014
Return-Path: <gcc-bugs-return-451429-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13528 invoked by alias); 13 May 2014 09:54:58 -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 13499 invoked by uid 48); 13 May 2014 09:54:55 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/61168] New: Assembler options (-Wa,*) are not propagated when using -flto
Date: Tue, 13 May 2014 09:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
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 cc
Message-ID: <bug-61168-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-05/txt/msg01121.txt.bz2
Content-length: 736

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida168

            Bug ID: 61168
           Summary: Assembler options (-Wa,*) are not propagated when
                    using -flto
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dominiq at lps dot ens.fr
                CC: hubicka at ucw dot cz, iains at gcc dot gnu.org

Compiling a code with -Wa,-q pass the -q option to the assembler:

as -arch x86_64 -force_cpusubtype_ALL -q -o /var/folders/...

(on darwin). Adding -flto does not allow it:

as -arch x86_64 -force_cpusubtype_ALL -o /var/folders/...


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

* [Bug c/61165] bad location for conversion in return
  2014-05-13  6:40 [Bug preprocessor/61165] New: unfriendly diagnostic from macro expansion tromey at gcc dot gnu.org
  2014-05-13  9:47 ` [Bug c/61165] bad location for conversion in return manu at gcc dot gnu.org
@ 2014-05-13 15:53 ` tromey at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at gcc dot gnu.org @ 2014-05-13 15:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Tom Tromey <tromey at gcc dot gnu.org> ---
I think 55252 is a more complete analysis of the same problem.
Thanks for pointing that one out.

*** This bug has been marked as a duplicate of bug 55252 ***


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

end of thread, other threads:[~2014-05-13 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13  6:40 [Bug preprocessor/61165] New: unfriendly diagnostic from macro expansion tromey at gcc dot gnu.org
2014-05-13  9:47 ` [Bug c/61165] bad location for conversion in return manu at gcc dot gnu.org
2014-05-13 15:53 ` 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).