From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6393 invoked by alias); 9 Apr 2002 11:36:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 6370 invoked by uid 71); 9 Apr 2002 11:36:02 -0000 Date: Tue, 09 Apr 2002 04:36:00 -0000 Message-ID: <20020409113602.6369.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Alan Modra Subject: Re: optimization/6233: simple loop miscompilation Reply-To: Alan Modra X-SW-Source: 2002-04/txt/msg00522.txt.bz2 List-Id: The following reply was made to PR optimization/6233; it has been noted by GNATS. From: Alan Modra To: gcc-gnats@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Subject: Re: optimization/6233: simple loop miscompilation Date: Tue, 9 Apr 2002 20:57:35 +0930 This patch cures PR6233. gcc/ChangeLog * alias.c (nonlocal_referenced_p): Make global. * tree.h (nonlocal_referenced_p): Declare. * loop.c (prescan_loop): Set has_nonconst_call for pure functions. -- Alan Modra IBM OzLabs - Linux Technology Centre Index: gcc/alias.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/alias.c,v retrieving revision 1.169 diff -u -p -r1.169 alias.c --- gcc/alias.c 4 Apr 2002 22:48:16 -0000 1.169 +++ gcc/alias.c 9 Apr 2002 10:55:06 -0000 @@ -112,7 +112,6 @@ static int write_dependence_p static int nonlocal_mentioned_p_1 PARAMS ((rtx *, void *)); static int nonlocal_mentioned_p PARAMS ((rtx)); static int nonlocal_referenced_p_1 PARAMS ((rtx *, void *)); -static int nonlocal_referenced_p PARAMS ((rtx)); static int nonlocal_set_p_1 PARAMS ((rtx *, void *)); static int nonlocal_set_p PARAMS ((rtx)); @@ -2455,7 +2454,7 @@ nonlocal_referenced_p_1 (loc, data) /* Returns non-zero if X might reference something which is not local to the function and is not constant. */ -static int +int nonlocal_referenced_p (x) rtx x; { Index: gcc/loop.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop.c,v retrieving revision 1.394 diff -u -p -r1.394 loop.c --- gcc/loop.c 3 Apr 2002 07:56:44 -0000 1.394 +++ gcc/loop.c 9 Apr 2002 10:55:27 -0000 @@ -2493,6 +2493,8 @@ prescan_loop (loop) loop_info->unknown_address_altered = 1; loop_info->has_nonconst_call = 1; } + else if (nonlocal_referenced_p (insn)) + loop_info->has_nonconst_call = 1; loop_info->has_call = 1; if (can_throw_internal (insn)) loop_info->has_multiple_exit_targets = 1; Index: gcc/tree.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree.h,v retrieving revision 1.327 diff -u -p -r1.327 tree.h --- gcc/tree.h 4 Apr 2002 22:19:38 -0000 1.327 +++ gcc/tree.h 9 Apr 2002 10:55:30 -0000 @@ -2815,6 +2815,7 @@ extern int alias_sets_conflict_p PARAMS HOST_WIDE_INT)); extern int readonly_fields_p PARAMS ((tree)); extern int objects_must_conflict_p PARAMS ((tree, tree)); +extern int nonlocal_referenced_p PARAMS ((rtx)); struct obstack;