public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components
@ 2009-08-23 20:35 janus at gcc dot gnu dot org
2009-08-24 9:21 ` [Bug middle-end/41149] " rguenth at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-08-23 20:35 UTC (permalink / raw)
To: gcc-bugs
There seems to be a bug in the tree dump related to procedure pointer
components ('PPC', a Fortran 2003 feature which would probably be described as
"function pointers as structure components" in C). In particular: When calling
such a PPC, the dump only shows the component name, while the name of the
object which contains the component is omitted. This is not language dependent
and is also observed for C code, as the following example shows:
#include <stdio.h>
typedef long funcPtr(char *);
long func(char * str)
{
printf("%s\n", str);
return 0;
}
int main(void)
{
long l;
struct
{
funcPtr *ppc;
} t;
t.ppc = func;
l = t.ppc("Hello");
return l;
}
The dump shows (with -fdump-tree-original):
t.ppc = (long int (*<T617>) (char *)) func;
l = ppc ((char *) "Hello");
In the second line I would expect to see 't.ppc' instead of just 'ppc'.
For a Fortran example see PR 41139.
--
Summary: -fdump-tree-original and procedure pointer components
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
@ 2009-08-24 9:21 ` rguenth at gcc dot gnu dot org
2009-08-24 19:44 ` janus at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-24 9:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-08-24 09:21 -------
Seems like by design, see tree-pretty-print.c:print_call_name
Likely for printing prettier member function names. IMHO we should just
drop this function on the floor considering it prints t.w (...) for
struct
{
struct
{
funcPtr *ppc;
} w;
} t;
t.w.ppc = func;
l = t.w.ppc("Hello");
I'll happily approve a patch that passes bootstrap and testing that
reduces the function to strip an address-taking operation (note the
CALL_EXPR operand is an address of the function, so &a (...) should
print as a (...) and p (...) should print as (*p) (...)).
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-08-24 09:21:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
2009-08-24 9:21 ` [Bug middle-end/41149] " rguenth at gcc dot gnu dot org
@ 2009-08-24 19:44 ` janus at gcc dot gnu dot org
2009-08-25 9:08 ` janus at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-08-24 19:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from janus at gcc dot gnu dot org 2009-08-24 19:44 -------
(In reply to comment #1)
> Seems like by design, see tree-pretty-print.c:print_call_name
Thanks for pointing me at the right place.
> Likely for printing prettier member function names. IMHO we should just
> drop this function on the floor
I wouldn't go as far as dropping the whole function, but at least the part
concerning COMPONENT_REF seems pretty braindead to me. I'd propose to just drop
this and replace it by something more sane, like here:
Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c (revision 151053)
+++ gcc/tree-pretty-print.c (working copy)
@@ -2705,19 +2705,6 @@ print_call_name (pretty_printer *buffer,
dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
break;
- case COMPONENT_REF:
- /* The function is a pointer contained in a structure. */
- if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
- TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
- dump_function_name (buffer, TREE_OPERAND (op0, 1), flags);
- else
- dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
- /* else
- We can have several levels of structures and a function
- pointer inside. This is not implemented yet... */
- /* NIY;*/
- break;
-
case ARRAY_REF:
if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
@@ -2725,6 +2712,7 @@ print_call_name (pretty_printer *buffer,
dump_generic_node (buffer, op0, 0, flags, false);
break;
+ case COMPONENT_REF:
case SSA_NAME:
case OBJ_TYPE_REF:
dump_generic_node (buffer, op0, 0, flags, false);
This seems to do the right thing (also for multiply nested function pointers as
in comment #1). Regtesting now ...
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2009-08-24 09:21:23 |2009-08-24 19:44:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
2009-08-24 9:21 ` [Bug middle-end/41149] " rguenth at gcc dot gnu dot org
2009-08-24 19:44 ` janus at gcc dot gnu dot org
@ 2009-08-25 9:08 ` janus at gcc dot gnu dot org
2009-08-25 9:13 ` rguenther at suse dot de
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-08-25 9:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from janus at gcc dot gnu dot org 2009-08-25 09:08 -------
The patch in comment #2 was successfully bootstrapped and regtested. Ok for
trunk?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-08-25 9:08 ` janus at gcc dot gnu dot org
@ 2009-08-25 9:13 ` rguenther at suse dot de
2009-08-25 9:36 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenther at suse dot de @ 2009-08-25 9:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenther at suse dot de 2009-08-25 09:13 -------
Subject: Re: -fdump-tree-original and procedure pointer
components
On Tue, 25 Aug 2009, janus at gcc dot gnu dot org wrote:
> ------- Comment #3 from janus at gcc dot gnu dot org 2009-08-25 09:08 -------
> The patch in comment #2 was successfully bootstrapped and regtested. Ok for
> trunk?
Ok with a changelog entry.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-08-25 9:13 ` rguenther at suse dot de
@ 2009-08-25 9:36 ` janus at gcc dot gnu dot org
2009-08-25 9:38 ` janus at gcc dot gnu dot org
2009-08-25 11:21 ` steven at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-08-25 9:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from janus at gcc dot gnu dot org 2009-08-25 09:35 -------
Subject: Bug 41149
Author: janus
Date: Tue Aug 25 09:35:41 2009
New Revision: 151075
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151075
Log:
2009-08-25 Janus Weil <janus@gcc.gnu.org>
PR middle-end/41149
* tree-pretty-print.c (print_call_name): Print the correct call name
for procedure pointer components.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-pretty-print.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-08-25 9:36 ` janus at gcc dot gnu dot org
@ 2009-08-25 9:38 ` janus at gcc dot gnu dot org
2009-08-25 11:21 ` steven at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-08-25 9:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from janus at gcc dot gnu dot org 2009-08-25 09:38 -------
Fixed with r151075. Closing.
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41149] -fdump-tree-original and procedure pointer components
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-08-25 9:38 ` janus at gcc dot gnu dot org
@ 2009-08-25 11:21 ` steven at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-08-25 11:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from steven at gcc dot gnu dot org 2009-08-25 11:21 -------
Please drop the patch in gcc-patches as well (just post it with a comment that
you've committed it to fix this PR).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-25 11:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-23 20:35 [Bug middle-end/41149] New: -fdump-tree-original and procedure pointer components janus at gcc dot gnu dot org
2009-08-24 9:21 ` [Bug middle-end/41149] " rguenth at gcc dot gnu dot org
2009-08-24 19:44 ` janus at gcc dot gnu dot org
2009-08-25 9:08 ` janus at gcc dot gnu dot org
2009-08-25 9:13 ` rguenther at suse dot de
2009-08-25 9:36 ` janus at gcc dot gnu dot org
2009-08-25 9:38 ` janus at gcc dot gnu dot org
2009-08-25 11:21 ` steven at gcc dot gnu dot 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).