This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12640] [tree-ssa] strlen builtin causes stack overflow building tk
- From: "dnovillo at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Nov 2003 18:32:56 -0000
- Subject: [Bug optimization/12640] [tree-ssa] strlen builtin causes stack overflow building tk
- References: <20031016144712.12640.green@redhat.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dnovillo at redhat dot com 2003-11-12 18:32 -------
Subject: Re: [tree-ssa] strlen builtin causes
stack overflow building tk
On Wed, 2003-11-12 at 13:22, steven at gcc dot gnu dot org wrote:
> ndex: tree-ssa-ccp.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
> retrieving revision 1.1.2.108
> diff -c -3 -p -r1.1.2.108 tree-ssa-ccp.c
> *** tree-ssa-ccp.c 11 Nov 2003 18:04:46 -0000 1.1.2.108
> --- tree-ssa-ccp.c 12 Nov 2003 18:20:25 -0000
> *************** get_strlen (tree arg)
> *** 1922,1928 ****
> arg_len = prev_arg_len = NULL_TREE;
> for (i = 0; i < PHI_NUM_ARGS (def_stmt); i++)
> {
> ! arg_len = get_strlen (PHI_ARG_DEF (def_stmt, i));
> if (arg_len == NULL_TREE)
> return NULL_TREE;
>
> --- 1922,1939 ----
> arg_len = prev_arg_len = NULL_TREE;
> for (i = 0; i < PHI_NUM_ARGS (def_stmt); i++)
> {
> ! tree arg_def_stmt = PHI_ARG_DEF (def_stmt, i);
> !
> ! /* If this PHI has itself as an argument, we cannot
> ! determine the string length of this argument. However,
> ! if we can find a constant string length for the other
> ! PHI args then we can still be sure that this is a
> ! constant string length. So be optimistic and just
> ! continue with the next argument. */
> ! if (arg_def_stmt == def_stmt)
> ! continue;
> !
> ! arg_len = get_strlen (arg_def_stmt);
> if (arg_len == NULL_TREE)
> return NULL_TREE;
>
Looks correct. Care to take it through a full bootstrap/test cycle?
Diego.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12640