public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c)
@ 2004-02-18 18:43 ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 18:48 ` [Bug middle-end/14197] " ehrhardt at mathematik dot uni-ulm dot de
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: ehrhardt at mathematik dot uni-ulm dot de @ 2004-02-18 18:43 UTC (permalink / raw)
To: gcc-bugs
string-asm-2.c from the gcc-testsuite fails on at least tree-ssa on
sparc-sun-solaris. The code generated for some bcopy-calls with -O is
wrong because it doesn't take overlapping memory into account.
The code in question essentially is this (see the testsuite for a full
example):
char y[64] = "sometext";
bcopy (y+1, y+2, 6);
The bcopy-call is rewritten by tree-ssa as
bcopy (&y[1], &y[2], 6)
This triggers an optimization in the expander that tries to use
memcpy instead of memmove if the second operand of bcopy points
to read-only memory. This test is done like this by readonly_data_expr
in builtins.c:
if (TREE_CODE (exp) == ADDR_EXPR)
return decl_readonly_section (TREE_OPERAND (exp, 0), 0);
else
return false;
This is fine for an ADDR_EXPR that references a decl or a string constant
but what we actually have is an ADDR_EXPR that references an ARRAY_REF.
decl_readonly_section isn't prepared to deal with such a tree and
wrongly returns true (readonly) here.
I'll attach a patch that should fix this.
regards Christian
--
Summary: Wrong code for bcopy/memmove (string-asm-2.c)
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: wrong-code
Severity: critical
Priority: P1
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ehrhardt at mathematik dot uni-ulm dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
@ 2004-02-18 18:48 ` ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 19:02 ` [Bug middle-end/14197] [tree-ssa] " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ehrhardt at mathematik dot uni-ulm dot de @ 2004-02-18 18:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ehrhardt at mathematik dot uni-ulm dot de 2004-02-18 18:48 -------
Created an attachment (id=5767)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5767&action=view)
Proposed patch
You'll also need the one line patch for 13769 to bootstrap tree-ssa on
sparc-sun-solaris.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] [tree-ssa] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 18:48 ` [Bug middle-end/14197] " ehrhardt at mathematik dot uni-ulm dot de
@ 2004-02-18 19:02 ` pinskia at gcc dot gnu dot org
2004-02-27 12:20 ` rth at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-18 19:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-18 19:02 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-02-18 19:02:35
date| |
Summary|Wrong code for bcopy/memmove|[tree-ssa] Wrong code for
|(string-asm-2.c) |bcopy/memmove (string-asm-
| |2.c)
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] [tree-ssa] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 18:48 ` [Bug middle-end/14197] " ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 19:02 ` [Bug middle-end/14197] [tree-ssa] " pinskia at gcc dot gnu dot org
@ 2004-02-27 12:20 ` rth at gcc dot gnu dot org
2004-02-28 21:23 ` ehrhardt at mathematik dot uni-ulm dot de
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-02-27 12:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-02-27 12:19 -------
Actually, given that FUNCTION_DECL and VAR_DECL have already been handled,
it seems more likely that the varasm.c change should just be abort().
Would you please run the testsuite with that change?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] [tree-ssa] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (2 preceding siblings ...)
2004-02-27 12:20 ` rth at gcc dot gnu dot org
@ 2004-02-28 21:23 ` ehrhardt at mathematik dot uni-ulm dot de
2004-03-16 4:44 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ehrhardt at mathematik dot uni-ulm dot de @ 2004-02-28 21:23 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Last reconfirmed|2004-02-18 19:02:35 |2004-02-28 21:23:05
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] [tree-ssa] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (3 preceding siblings ...)
2004-02-28 21:23 ` ehrhardt at mathematik dot uni-ulm dot de
@ 2004-03-16 4:44 ` pinskia at gcc dot gnu dot org
2004-04-23 7:27 ` bje at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-16 4:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-16 04:44 -------
*** Bug 14593 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |kazu at cs dot umass dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] [tree-ssa] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (4 preceding siblings ...)
2004-03-16 4:44 ` pinskia at gcc dot gnu dot org
@ 2004-04-23 7:27 ` bje at gcc dot gnu dot org
2004-04-23 9:16 ` ehrhardt at mathematik dot uni-ulm dot de
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bje at gcc dot gnu dot org @ 2004-04-23 7:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bje at gcc dot gnu dot org 2004-04-23 05:43 -------
What are we waiting on to close this PR?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/14197] [tree-ssa] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (5 preceding siblings ...)
2004-04-23 7:27 ` bje at gcc dot gnu dot org
@ 2004-04-23 9:16 ` ehrhardt at mathematik dot uni-ulm dot de
2004-05-22 21:47 ` [Bug tree-optimization/14197] [3.5 Regression] " pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ehrhardt at mathematik dot uni-ulm dot de @ 2004-04-23 9:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ehrhardt at mathematik dot uni-ulm dot de 2004-04-23 07:40 -------
The bug is still open because the patch did not get applied and the
test is still failing. See e.g.
http://gcc.gnu.org/ml/gcc-testresults/2004-04/msg00854.html
BTW: The WAITING state is exclusively for the case where the submitter
needs to provide more information. Is this really what you intended?
regards Christian
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Last reconfirmed|2004-02-28 21:23:05 |2004-04-23 07:40:41
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/14197] [3.5 Regression] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (6 preceding siblings ...)
2004-04-23 9:16 ` ehrhardt at mathematik dot uni-ulm dot de
@ 2004-05-22 21:47 ` pinskia at gcc dot gnu dot org
2004-05-25 14:33 ` pinskia at gcc dot gnu dot org
2004-05-25 14:33 ` cvs-commit at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-22 21:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-21 23:28 -------
A different patch is here: <http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01401.html>.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |uweigand at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/14197] [3.5 Regression] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (7 preceding siblings ...)
2004-05-22 21:47 ` [Bug tree-optimization/14197] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-05-25 14:33 ` pinskia at gcc dot gnu dot org
2004-05-25 14:33 ` cvs-commit at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-25 14:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-24 16:51 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/14197] [3.5 Regression] Wrong code for bcopy/memmove (string-asm-2.c)
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
` (8 preceding siblings ...)
2004-05-25 14:33 ` pinskia at gcc dot gnu dot org
@ 2004-05-25 14:33 ` cvs-commit at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-25 14:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-05-24 16:37 -------
Subject: Bug 14197
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: uweigand@gcc.gnu.org 2004-05-24 16:37:18
Modified files:
gcc : ChangeLog Makefile.in builtins.c tree-gimple.c
Log message:
PR tree-optimization/14197
* builtins.c: Include "tree-gimple.h"
(readonly_data_expr): Use get_base_address. Make sure to call
decl_readonly_section only on trees it can handle.
* tree-gimple.c (get_base_address): Accept STRING_CST and
CONSTRUCTOR expressions.
* Makefile.in: Update dependencies.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3737&r2=2.3738
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.1282&r2=1.1283
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.325&r2=1.326
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-gimple.c.diff?cvsroot=gcc&r1=2.1&r2=2.2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14197
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-05-24 16:51 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-18 18:43 [Bug middle-end/14197] New: Wrong code for bcopy/memmove (string-asm-2.c) ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 18:48 ` [Bug middle-end/14197] " ehrhardt at mathematik dot uni-ulm dot de
2004-02-18 19:02 ` [Bug middle-end/14197] [tree-ssa] " pinskia at gcc dot gnu dot org
2004-02-27 12:20 ` rth at gcc dot gnu dot org
2004-02-28 21:23 ` ehrhardt at mathematik dot uni-ulm dot de
2004-03-16 4:44 ` pinskia at gcc dot gnu dot org
2004-04-23 7:27 ` bje at gcc dot gnu dot org
2004-04-23 9:16 ` ehrhardt at mathematik dot uni-ulm dot de
2004-05-22 21:47 ` [Bug tree-optimization/14197] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-05-25 14:33 ` pinskia at gcc dot gnu dot org
2004-05-25 14:33 ` cvs-commit at gcc dot gnu dot org
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).