This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/6233: simple loop miscompilation
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 9 Apr 2002 11:36:02 -0000
- Subject: Re: optimization/6233: simple loop miscompilation
- Reply-to: Alan Modra <amodra at bigpond dot net dot au>
The following reply was made to PR optimization/6233; it has been noted by GNATS.
From: Alan Modra <amodra@bigpond.net.au>
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;