public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: vmakarov@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, vmakarov@gcc.gnu.org,
	vmakarov@redhat.com
Subject: Re: c/6875: IA64 compiler crash when -O3
Date: Thu, 30 May 2002 16:16:00 -0000	[thread overview]
Message-ID: <20020530231200.31305.qmail@sources.redhat.com> (raw)

Synopsis: IA64 compiler crash when -O3

State-Changed-From-To: analyzed->feedback
State-Changed-By: vmakarov
State-Changed-When: Thu May 30 16:12:00 2002
State-Changed-Why:
      I don't know well the font-end.  But I see the two ways of the
    problem solution:
    
      o making another copy of tree of the call.
      o clearing RTL code for tree label declarations in the call.
    
      I prefer the 2nd solution as less expensive one.
    
      Here the patch is.  I've tried regression tests and bootstrap on
    ia64/x86 for the patch (everithin looks ok).
    
    Vlad
    
    2002-05-30  Vladimir Makarov  <vmakarov@redhat.com>
    
            * langhooks-def.h (lhd_tree_inlining_walk_tree): New function
            prototype.
            (LANG_HOOKS_TREE_INLINING_INITIALIZER): Add
            LANG_HOOKS_TREE_INLINING_WALK_TREE.
            
            * langhooks.h (lang_hooks_for_tree_inlining): New member
            `walk_tree'.
            
            * langhooks.c (lhd_tree_inlining_walk_tree): New function.
            
            * c-tree.h (c_walk_tree): New function prototype.
    
            * c-objc-common.c (c_walk_tree): New function.
    
            * c-lang.c (LANG_HOOKS_TREE_INLINING_WALK_TREE): Redefine it.
    
            * cp/cp-tree.h (cp_walk_tree): New function prototype.
    
            * cp/tree.c (cp_walk_tree): New function.
    
            * calls.c (clear_label_decls): New function.
            (expand_call): Clear labels for the second pass.
    
    Index: c-lang.c
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/c-lang.c,v
    retrieving revision 1.74.6.2
    diff -d -c -p -r1.74.6.2 c-lang.c
    *** c-lang.c    23 May 2002 17:57:26 -0000      1.74.6.2
    --- c-lang.c    30 May 2002 19:40:58 -0000
    *************** static void c_init_options PARAMS ((void
    *** 55,60 ****
    --- 55,62 ----
      #undef LANG_HOOKS_SET_YYDEBUG
      #define LANG_HOOKS_SET_YYDEBUG c_set_yydebug
      
    + #undef LANG_HOOKS_TREE_INLINING_WALK_TREE
    + #define LANG_HOOKS_TREE_INLINING_WALK_TREE c_walk_tree
      #undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
      #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
        c_cannot_inline_tree_fn
    Index: c-objc-common.c
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/c-objc-common.c,v
    retrieving revision 1.3.2.2
    diff -d -c -p -r1.3.2.2 c-objc-common.c
    *** c-objc-common.c     28 Mar 2002 18:49:58 -0000      1.3.2.2
    --- c-objc-common.c     30 May 2002 19:40:58 -0000
    *************** c_missing_noreturn_ok_p (decl)
    *** 51,56 ****
    --- 51,68 ----
        return flag_hosted && MAIN_NAME_P (DECL_ASSEMBLER_NAME (decl));
      }
      
    + 
    + /* The function just calls walk_tree.  */
    + tree 
    + c_walk_tree (tp, func, data, htab)
    +      tree *tp;
    +      walk_tree_fn func;
    +      void *data;
    +      void *htab;
    + {
    +   return walk_tree (tp, func, data, htab);
    + }
    + 
      /* We want to inline `extern inline' functions even if this would
         violate inlining limits.  Some glibc and linux constructs depend on
         such functions always being inlined when optimizing.  */
    Index: c-tree.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/c-tree.h,v
    retrieving revision 1.81.2.2
    diff -d -c -p -r1.81.2.2 c-tree.h
    *** c-tree.h    28 Mar 2002 18:49:58 -0000      1.81.2.2
    --- c-tree.h    30 May 2002 19:40:58 -0000
    *************** extern void c_expand_decl_stmt          
    *** 221,226 ****
    --- 221,228 ----
      
      
      /* in c-objc-common.c */
    + extern tree c_walk_tree                               PARAMS ((tree *, walk_tree_fn,
    +                                                        void *, void *));
      extern int c_disregard_inline_limits          PARAMS ((tree));
      extern int c_cannot_inline_tree_fn            PARAMS ((tree *));
      extern const char *c_objc_common_init         PARAMS ((const char *));
    Index: calls.c
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/calls.c,v
    retrieving revision 1.221.2.2
    diff -d -c -p -r1.221.2.2 calls.c
    *** calls.c     4 Apr 2002 23:28:47 -0000       1.221.2.2
    --- calls.c     30 May 2002 19:40:59 -0000
    *************** Software Foundation, 59 Temple Place - S
    *** 27,32 ****
    --- 27,33 ----
      #include "expr.h"
      #include "libfuncs.h"
      #include "function.h"
    + #include "langhooks.h"
      #include "regs.h"
      #include "toplev.h"
      #include "output.h"
    *************** static int flags_from_decl_or_type              PAR
    *** 219,226 ****
      static rtx try_to_integrate                   PARAMS ((tree, tree, rtx,
                                                             int, tree, rtx));
      static int check_sibcall_argument_overlap_1   PARAMS ((rtx));
    ! static int check_sibcall_argument_overlap     PARAMS ((rtx, struct arg_data *));
    ! 
      static int combine_pending_stack_adjustment_and_call
                                                      PARAMS ((int, struct args_size *, int));
      
    --- 220,229 ----
      static rtx try_to_integrate                   PARAMS ((tree, tree, rtx,
                                                             int, tree, rtx));
      static int check_sibcall_argument_overlap_1   PARAMS ((rtx));
    ! static int check_sibcall_argument_overlap     PARAMS ((rtx,
    !                                                        struct arg_data *));
    ! static tree clear_label_decls                 PARAMS ((tree *, int *,
    !                                                        void *));
      static int combine_pending_stack_adjustment_and_call
                                                      PARAMS ((int, struct args_size *, int));
      
    *************** check_sibcall_argument_overlap (insn, ar
    *** 2062,2067 ****
    --- 2065,2090 ----
        return insn != NULL_RTX;
      }
      
    + /* The following function is called by tree inline hook walk_tree to
    +    clear rtl code for the labels.  */
    + 
    + static tree
    + clear_label_decls (tp, walk_subtrees, data)
    +      tree *tp;
    +      int *walk_subtrees;
    +      void *data ATTRIBUTE_UNUSED;
    + {
    +   *walk_subtrees = 1;
    +   if (TREE_CODE (*tp) == LABEL_DECL)
    +     {
    +       SET_DECL_RTL (*tp, NULL);
    +       *walk_subtrees = 0;
    +     }
    + 
    +   /* Keep iterating.  */
    +   return NULL_TREE;
    + }
    + 
      /* Generate all the code for a function call
         and return an rtx for its value.
         Store the value in TARGET (specified as an rtx) if convenient.
    *************** expand_call (exp, target, ignore)
    *** 2659,2664 ****
    --- 2682,2694 ----
                 able to get rid of them.  */
              expand_start_target_temps ();
            }
    + 
    +       if (pass != 0)
    +       /* EXP may contain label declaration whose LABEL_CODE will be
    +            not defined in the normal call code (2nd pass) unless we
    +            clear its RTL code generated for the sibling call.  */
    +       (*lang_hooks.tree_inlining.walk_tree) (&exp, clear_label_decls,
    +                                              NULL, NULL);
      
            /* Don't let pending stack adjusts add up to too much.
             Also, do all pending adjustments now if there is any chance
    Index: langhooks-def.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
    retrieving revision 1.8.10.2
    diff -d -c -p -r1.8.10.2 langhooks-def.h
    *** langhooks-def.h     23 May 2002 17:57:27 -0000      1.8.10.2
    --- langhooks-def.h     30 May 2002 19:40:59 -0000
    *************** extern void lhd_print_tree_nothing PARAM
    *** 50,55 ****
    --- 50,57 ----
      extern void lhd_set_yydebug PARAMS ((int));
      
      /* Declarations of default tree inlining hooks.  */
    + tree lhd_tree_inlining_walk_tree              PARAMS ((tree *, walk_tree_fn,
    +                                                        void *, void *));
      tree lhd_tree_inlining_walk_subtrees          PARAMS ((tree *, int *,
                                                             walk_tree_fn,
                                                             void *, void *));
    *************** tree lhd_tree_inlining_convert_parm_for_
    *** 87,92 ****
    --- 89,95 ----
      #define LANG_HOOKS_SET_YYDEBUG                lhd_set_yydebug
      
      /* Tree inlining hooks.  */
    + #define LANG_HOOKS_TREE_INLINING_WALK_TREE lhd_tree_inlining_walk_tree
      #define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
      #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
        lhd_tree_inlining_cannot_inline_tree_fn
    *************** tree lhd_tree_inlining_convert_parm_for_
    *** 110,115 ****
    --- 113,119 ----
        lhd_tree_inlining_convert_parm_for_inlining
      
      #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
    +   LANG_HOOKS_TREE_INLINING_WALK_TREE, \
        LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
        LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
        LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, \
    Index: langhooks.c
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/langhooks.c,v
    retrieving revision 1.16.2.2
    diff -d -c -p -r1.16.2.2 langhooks.c
    *** langhooks.c 21 Mar 2002 23:12:21 -0000      1.16.2.2
    --- langhooks.c 30 May 2002 19:40:59 -0000
    *************** hook_get_alias_set_0 (t)
    *** 126,131 ****
    --- 126,143 ----
        return 0;
      }
      
    + /* This is the default function for lang_hooks.tree_inlining.walk_tree.  */
    + 
    + tree
    + lhd_tree_inlining_walk_tree (tp, func, data, htab)
    +      tree *tp ATTRIBUTE_UNUSED;
    +      walk_tree_fn func ATTRIBUTE_UNUSED;
    +      void *data ATTRIBUTE_UNUSED;
    +      void *htab ATTRIBUTE_UNUSED;
    + {
    +   return NULL_TREE;
    + }
    + 
      /* lang_hooks.tree_inlining.walk_subtrees is called by walk_tree()
         after handling common cases, but before walking code-specific
         sub-trees.  If this hook is overridden for a language, it should
    Index: langhooks.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
    retrieving revision 1.15.8.2
    diff -d -c -p -r1.15.8.2 langhooks.h
    *** langhooks.h 23 May 2002 17:57:28 -0000      1.15.8.2
    --- langhooks.h 30 May 2002 19:40:59 -0000
    *************** typedef void (*lang_print_tree_hook) PAR
    *** 29,34 ****
    --- 29,39 ----
      
      struct lang_hooks_for_tree_inlining
      {
    +   union tree_node *(*walk_tree) PARAMS ((union tree_node **,
    +                                        union tree_node *(*)
    +                                        (union tree_node **,
    +                                         int *, void *),
    +                                        void *, void *));
        union tree_node *(*walk_subtrees) PARAMS ((union tree_node **, int *,
                                                 union tree_node *(*)
                                                 (union tree_node **,
    Index: cp/cp-tree.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
    retrieving revision 1.681.2.12
    diff -d -c -p -r1.681.2.12 cp-tree.h
    *** cp/cp-tree.h        23 May 2002 17:57:42 -0000      1.681.2.12
    --- cp/cp-tree.h        30 May 2002 19:40:59 -0000
    *************** extern int char_type_p                  
    *** 4280,4285 ****
    --- 4280,4287 ----
      extern void verify_stmt_tree                    PARAMS ((tree));
      extern tree find_tree                           PARAMS ((tree, tree));
      extern linkage_kind decl_linkage                PARAMS ((tree));
    + extern tree cp_walk_tree                      PARAMS ((tree *, walk_tree_fn,
    +                                                        void *, void *));
      extern tree cp_walk_subtrees PARAMS ((tree*, int*, walk_tree_fn,
                                          void*, void*));
      extern int cp_cannot_inline_tree_fn PARAMS ((tree*));
    Index: cp/tree.c
    ===================================================================
    RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
    retrieving revision 1.268.2.4
    diff -d -c -p -r1.268.2.4 tree.c
    *** cp/tree.c   16 May 2002 02:09:15 -0000      1.268.2.4
    --- cp/tree.c   30 May 2002 19:41:00 -0000
    *************** make_ptrmem_cst (type, member)
    *** 2077,2082 ****
    --- 2077,2094 ----
        return ptrmem_cst;
      }
      
    + /* The function just calls walk_tree.  */
    + 
    + tree 
    + cp_walk_tree (tp, func, data, htab)
    +      tree *tp;
    +      walk_tree_fn func;
    +      void *data;
    +      void *htab;
    + {
    +   return walk_tree (tp, func, data, htab);
    + }
    + 
      /* Apply FUNC to all language-specific sub-trees of TP in a pre-order
         traversal.  Called from walk_tree().  */
      

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6875


             reply	other threads:[~2002-05-30 23:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-30 16:16 vmakarov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-15 16:18 ehrhardt
2003-01-01 18:36 Nathanael Nerode
2002-05-30 16:12 vmakarov
2002-05-30 16:10 vmakarov
2002-05-30 16:08 vmakarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020530231200.31305.qmail@sources.redhat.com \
    --to=vmakarov@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).