public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* alias.c: find_base_decl: TREE_CODE_CLASS of '3'
@ 2004-09-09  0:35 Jeffrey D. Oldham
  2004-09-09  0:44 ` Zack Weinberg
  0 siblings, 1 reply; 7+ messages in thread
From: Jeffrey D. Oldham @ 2004-09-09  0:35 UTC (permalink / raw)
  To: gcc; +Cc: Jeffrey D. Oldham

In gcc/alias.c, find_base_decl, the switch on TREE_CODE_CLASS (TREE_CODE 
(t)) has a case '3'.  How can '3' be a valid tree code class?  '1' and 
'2' are valid tree code classes.

-- 
Jeffrey D. Oldham
oldham@codesourcery.com

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

* Re: alias.c: find_base_decl: TREE_CODE_CLASS of '3'
  2004-09-09  0:35 alias.c: find_base_decl: TREE_CODE_CLASS of '3' Jeffrey D. Oldham
@ 2004-09-09  0:44 ` Zack Weinberg
  2004-09-09  0:59   ` Mike Stump
  0 siblings, 1 reply; 7+ messages in thread
From: Zack Weinberg @ 2004-09-09  0:44 UTC (permalink / raw)
  To: Jeffrey D. Oldham; +Cc: gcc

"Jeffrey D. Oldham" <oldham@codesourcery.com> writes:

> In gcc/alias.c, find_base_decl, the switch on TREE_CODE_CLASS (TREE_CODE 
> (t)) has a case '3'.  How can '3' be a valid tree code class?  '1' and 
> '2' are valid tree code classes.

On first glance, this would be dead code.  There is no tree code,
either language-independent or language-specific, with '3' for its
class in the source tree (checked with grep "DEFTREECODE.*'3'" *.def */*.def).

However, looking more closely at the code there, I wonder if this is
either something that ought to be using TREE_CODE_LENGTH, or something
that ought to be using get_inner_reference.  Or some other primitive I
don't know about.

zw

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

* Re: alias.c: find_base_decl: TREE_CODE_CLASS of '3'
  2004-09-09  0:44 ` Zack Weinberg
@ 2004-09-09  0:59   ` Mike Stump
  2004-09-09  1:44     ` Zack Weinberg
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Stump @ 2004-09-09  0:59 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, Jeffrey D. Oldham

On Sep 8, 2004, at 5:44 PM, Zack Weinberg wrote:

> "Jeffrey D. Oldham" <oldham@codesourcery.com> writes:
>
>> In gcc/alias.c, find_base_decl, the switch on TREE_CODE_CLASS 
>> (TREE_CODE
>> (t)) has a case '3'.  How can '3' be a valid tree code class?  '1' and
>> '2' are valid tree code classes.
>
> On first glance, this would be dead code.  There is no tree code,
> either language-independent or language-specific, with '3' for its
> class in the source tree (checked with grep "DEFTREECODE.*'3'" *.def 
> */*.def).
>
> However, looking more closely at the code there, I wonder if this is
> either something that ought to be using TREE_CODE_LENGTH, or something
> that ought to be using get_inner_reference.  Or some other primitive I
> don't know about.

With an Aug 13, 2001 cvs repo copy:

mrs bash[15] grep 3 *.def,v | grep DEFTREE
c-common.def,v:DEFTREECODE (IF_STMT, "if_stmt", 'e', 3)
c-common.def,v:DEFTREECODE (CASE_LABEL, "case_label", 'e', 3)
c-common.def,v:DEFTREECODE (CASE_LABEL, "case_label", 'e', 3)
tree.def,v:DEFTREECODE (REAL_CST, "real_cst", 'c', 3)
tree.def,v:DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 3)
tree.def,v:DEFTREECODE (STRING_CST, "string_cst", 'c', 3)
tree.def,v:DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", 'r', 3)
tree.def,v:DEFTREECODE (COND_EXPR, "cond_expr", 'e', 3)
tree.def,v:DEFTREECODE (BIND_EXPR, "bind_expr", 'e', 3)
tree.def,v:DEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", 'e', 3)
tree.def,v:DEFTREECODE (SAVE_EXPR, "save_expr", 'e', 3)
tree.def,v:DEFTREECODE (EXPR_WITH_FILE_LOCATION, 
"expr_with_file_location", 'e', 3)
tree.def,v:DEFTREECODE (CALL_EXPR, "call_expr", 'e', 3)
tree.def,v:DEFTREECODE (EXPR_WITH_FILE_LOCATION, 
"expr_with_file_location", 'e', 3)
tree.def,v:DEFTREECODE (REAL_CST, "real_cst", "c", 3)
tree.def,v:DEFTREECODE (COMPLEX_CST, "complex_cst", "c", 3)
tree.def,v:DEFTREECODE (STRING_CST, "string_cst", "c", 3)
tree.def,v:DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", "r", 3)
tree.def,v:DEFTREECODE (COND_EXPR, "cond_expr", "e", 3)
tree.def,v:DEFTREECODE (BIND_EXPR, "bind_expr", "e", 3)
tree.def,v:DEFTREECODE (CALL_EXPR, "call_expr", "e", 3)
tree.def,v:DEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", "e", 3)
tree.def,v:DEFTREECODE (SAVE_EXPR, "save_expr", "e", 3)

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

* Re: alias.c: find_base_decl: TREE_CODE_CLASS of '3'
  2004-09-09  0:59   ` Mike Stump
@ 2004-09-09  1:44     ` Zack Weinberg
  2004-09-09 18:13       ` Dale Johannesen
  0 siblings, 1 reply; 7+ messages in thread
From: Zack Weinberg @ 2004-09-09  1:44 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc, Jeffrey D. Oldham

Mike Stump <mrs@apple.com> writes:

> With an Aug 13, 2001 cvs repo copy:
>
> mrs bash[15] grep 3 *.def,v | grep DEFTREE

Uh, the difference between 3 and '3' is critical here.  The bare 3s
that your grep matched are the TREE_CODE_LENGTH values, not the
TREE_CODE_CLASS values.

There are plenty of 'e' EXPRs with three slots in current CVS, which
is why I thought the code might be meaning to check TREE_CODE_LENGTH.

zw

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

* Re: alias.c: find_base_decl: TREE_CODE_CLASS of '3'
  2004-09-09  1:44     ` Zack Weinberg
@ 2004-09-09 18:13       ` Dale Johannesen
  2004-09-09 18:40         ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Dale Johannesen @ 2004-09-09 18:13 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, Mike Stump, Dale Johannesen, Jeffrey D. Oldham

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

On Sep 8, 2004, at 6:44 PM, Zack Weinberg wrote:
> Mike Stump <mrs@apple.com> writes:
>
>> With an Aug 13, 2001 cvs repo copy:
>>
>> mrs bash[15] grep 3 *.def,v | grep DEFTREE
>
> Uh, the difference between 3 and '3' is critical here.  The bare 3s
> that your grep matched are the TREE_CODE_LENGTH values, not the
> TREE_CODE_CLASS values.
>
> There are plenty of 'e' EXPRs with three slots in current CVS, which
> is why I thought the code might be meaning to check TREE_CODE_LENGTH.

This is the patch from Richard Kenner that put it in.

http://gcc.gnu.org/ml/gcc-patches/2000-05/msg01680.html

The comment says

(find_base_decl): New function, from c_find_base_decl in c-common.c.

and the C-specific function no longer exists....was there ever a code 
'3'?
For ?: operator maybe?

[-- Attachment #2: Type: text/enriched, Size: 895 bytes --]

On Sep 8, 2004, at 6:44 PM, Zack Weinberg wrote:

<excerpt>Mike Stump <<mrs@apple.com> writes:


<excerpt>With an Aug 13, 2001 cvs repo copy:


mrs bash[15] grep 3 *.def,v | grep DEFTREE

</excerpt>

Uh, the difference between 3 and '3' is critical here.  The bare 3s

that your grep matched are the TREE_CODE_LENGTH values, not the

TREE_CODE_CLASS values.


There are plenty of 'e' EXPRs with three slots in current CVS, which

is why I thought the code might be meaning to check TREE_CODE_LENGTH.

</excerpt>

This is the patch from Richard Kenner that put it in.  


http://gcc.gnu.org/ml/gcc-patches/2000-05/msg01680.html


The comment says


<fontfamily><param>Courier</param><x-tad-bigger>(find_base_decl): New
function, from c_find_base_decl in c-common.c.


</x-tad-bigger></fontfamily>and the C-specific function no longer
exists....was there ever a code '3'?

For ?: operator maybe?


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

* Re: alias.c: find_base_decl: TREE_CODE_CLASS of '3'
  2004-09-09 18:13       ` Dale Johannesen
@ 2004-09-09 18:40         ` Richard Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2004-09-09 18:40 UTC (permalink / raw)
  To: Dale Johannesen; +Cc: Zack Weinberg, gcc, Mike Stump, Jeffrey D. Oldham

On Thu, Sep 09, 2004 at 10:30:59AM -0700, Dale Johannesen wrote:
> ...was there ever a code '3'?  For ?: operator maybe? 

No.


r~

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

* Re: alias.c: find_base_decl: TREE_CODE_CLASS of '3'
@ 2004-09-09 19:10 Richard Kenner
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Kenner @ 2004-09-09 19:10 UTC (permalink / raw)
  To: dalej; +Cc: gcc

    This is the patch from Richard Kenner that put it in.

    http://gcc.gnu.org/ml/gcc-patches/2000-05/msg01680.html

Ooops!

    The comment says
    (find_base_decl): New function, from c_find_base_decl in c-common.c.
    
    and the C-specific function no longer exists....

Right, but you can see it in the quoted patch.

    was there ever a code '3'?  For ?: operator maybe?

I don't think there ever was: I think COND_EXPR was always 'e'.  I suspect
the code in c-common.c was probably always wrong and I didn't notice it when
copying it into alias.c.  Clearly the intent was to operate on
TREE_CODE_LENGTH of 3 (COND_EXPR) and I think should be rewritten to do that.

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

end of thread, other threads:[~2004-09-09 19:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-09  0:35 alias.c: find_base_decl: TREE_CODE_CLASS of '3' Jeffrey D. Oldham
2004-09-09  0:44 ` Zack Weinberg
2004-09-09  0:59   ` Mike Stump
2004-09-09  1:44     ` Zack Weinberg
2004-09-09 18:13       ` Dale Johannesen
2004-09-09 18:40         ` Richard Henderson
2004-09-09 19:10 Richard Kenner

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