public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
@ 2014-01-17 14:01 rguenth at gcc dot gnu.org
2014-01-17 14:02 ` [Bug tree-optimization/59860] " rguenth at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-17 14:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
Bug ID: 59860
Summary: [4.8 Regression] ICE in compute_may_aliases, at
tree-ssa-structalias.c:6843
Product: gcc
Version: 4.8.3
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target: s390x-*-*
The following testcase ICEs at -O1
extern __inline __attribute__ ((__always_inline__)) __attribute__
((__gnu_inline__)) __attribute__ ((__artificial__)) char * __attribute__
((__nothrow__ , __leaf__))
strcat (char *__restrict __dest, const char *__restrict __src)
{
return __builtin___strcat_chk (__dest, __src, __builtin_object_size (__dest,
2 > 1));
}
static char raw_decode;
void foo (char **argv, char *outfilename)
{
if (**argv == 'r')
raw_decode = 1;
strcat (outfilename, raw_decode ? ".raw" : ".wav");
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
@ 2014-01-17 14:02 ` rguenth at gcc dot gnu.org
2014-01-17 14:28 ` [Bug tree-optimization/59860] [4.8/4.9 " rguenth at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-17 14:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-01-17
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Target Milestone|--- |4.8.3
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
2014-01-17 14:02 ` [Bug tree-optimization/59860] " rguenth at gcc dot gnu.org
@ 2014-01-17 14:28 ` rguenth at gcc dot gnu.org
2014-01-17 14:34 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-17 14:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
Known to work| |4.8.2
Summary|[4.8 Regression] ICE in |[4.8/4.9 Regression] ICE in
|compute_may_aliases, at |compute_may_aliases, at
|tree-ssa-structalias.c:6843 |tree-ssa-structalias.c:6843
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, on s390x we fold
# iftmp.0_1 = PHI <".raw"(4), ".wav"(5)>
# .MEM_12 = VDEF <.MEM_2>
__builtin___strcat_chk (outfilename_9(D), iftmp.0_1, 18446744073709551615);
to
_13 = __builtin_strlen (outfilename_9(D));
_14 = outfilename_9(D) + _13;
__builtin_memcpy (_14, iftmp.0_1, 5);
but not on other targets. Oh.
static tree
fold_builtin_strcat (location_t loc ATTRIBUTE_UNUSED, tree dst, tree src)
{
...
if (optimize_insn_for_speed_p ())
{
That doesn't work when called from GIMPLE.
and then
/* If we don't have a movstr we don't want to emit an strcpy
call. We have to do that if the length of the source string
isn't computable (in that case we can use memcpy probably
later expanding to a sequence of mov instructions). If we
have movstr instructions we can emit strcpy calls. */
if (!HAVE_movstr)
{
tree len = c_strlen (src, 1);
if (! len || TREE_SIDE_EFFECTS (len))
return NULL_TREE;
}
that probably makes it s390 specific.
But it's a latent issue with folding stmts from object-size but not updating
SSA form there.
I'll fix it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
2014-01-17 14:02 ` [Bug tree-optimization/59860] " rguenth at gcc dot gnu.org
2014-01-17 14:28 ` [Bug tree-optimization/59860] [4.8/4.9 " rguenth at gcc dot gnu.org
@ 2014-01-17 14:34 ` rguenth at gcc dot gnu.org
2014-01-19 14:55 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-17 14:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
tree-ssa-math-opts.c: && optimize_insn_for_speed_p ()
tree-switch-conversion.c: speed_p = optimize_insn_for_speed_p ();
also look broken to me. Those should all use optimize_function_for_speed
(cfun).
Or the insn predicate needs to ignore stale crtl->maybe_hot_insn_p when not
in RTL or currently expanding. Honza?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (2 preceding siblings ...)
2014-01-17 14:34 ` rguenth at gcc dot gnu.org
@ 2014-01-19 14:55 ` rguenth at gcc dot gnu.org
2014-01-20 11:02 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-19 14:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that after folding strcat_chk -> strcat -> strcpy (dst + strlen,
...)
we do gimplify_and_update_call_from_tree which as part of gimplification
folds the builtins again, which enters update_call_from_tree which tries
to preserve virtual operands (which are not yet there) and finally calls
gsi_replace which does update_stmt (). That causes virtual operands to be
marked for renaming even if the outer folding routines happily update
virtual operands correctly.
So the issue is that we re-enter the builtin folding machinery via
gimplification and that is able to fold things further than builtins.c
folding which recurses to the tree foldings.
I'm inclined to disable that if ctx->into_ssa, or add a new flag, ->fold_calls.
[in the end we want to remove all stmt folding from the gimplifier and
maybe have one strategical place where we fold all stmts once]
Or, less intrusive, remove that strcat folding from GENERIC folding
(builtins.c) as we have tree-ssa-strlen.c now which optimizes it for
the interesting case of an already available string length - generally
folding strcat to strcpy (dst + strlen (dst), src) isn't profitable.
That also gets rid of that odd optimize_insn_for_speed_p call in builtins.c
[I've skimmed through other calls we generate in builtins.c and decided the
above is the only case where we can recurse into gimple call folding]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (3 preceding siblings ...)
2014-01-19 14:55 ` rguenth at gcc dot gnu.org
@ 2014-01-20 11:02 ` rguenth at gcc dot gnu.org
2014-01-20 11:06 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-20 11:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Jan 20 11:01:53 2014
New Revision: 206799
URL: http://gcc.gnu.org/viewcvs?rev=206799&root=gcc&view=rev
Log:
2014-01-20 Richard Biener <rguenther@suse.de>
PR middle-end/59860
* builtins.c (fold_builtin_strcat): Remove case better handled
by tree-ssa-strlen.c.
* gcc.dg/pr59860.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/pr59860.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (5 preceding siblings ...)
2014-01-20 11:06 ` rguenth at gcc dot gnu.org
@ 2014-01-20 11:06 ` rguenth at gcc dot gnu.org
2014-01-20 18:18 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-20 11:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Jan 20 11:06:21 2014
New Revision: 206800
URL: http://gcc.gnu.org/viewcvs?rev=206800&root=gcc&view=rev
Log:
2014-01-20 Richard Biener <rguenther@suse.de>
PR middle-end/59860
* builtins.c (fold_builtin_strcat): Remove case better handled
by tree-ssa-strlen.c.
* gcc.dg/pr59860.c: New testcase.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr59860.c
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/builtins.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (4 preceding siblings ...)
2014-01-20 11:02 ` rguenth at gcc dot gnu.org
@ 2014-01-20 11:06 ` rguenth at gcc dot gnu.org
2014-01-20 11:06 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-20 11:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (6 preceding siblings ...)
2014-01-20 11:06 ` rguenth at gcc dot gnu.org
@ 2014-01-20 18:18 ` jakub at gcc dot gnu.org
2014-01-20 18:20 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-20 18:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Mon Jan 20 18:18:21 2014
New Revision: 206848
URL: http://gcc.gnu.org/viewcvs?rev=206848&root=gcc&view=rev
Log:
PR middle-end/59860
* tree.h (fold_builtin_strcat): New prototype.
* builtins.c (fold_builtin_strcat): No longer static. Add len
argument, if non-NULL, don't call c_strlen. Optimize
directly into __builtin_memcpy instead of __builtin_strcpy.
(fold_builtin_2): Adjust fold_builtin_strcat caller.
* gimple-fold.c (gimple_fold_builtin): Handle BUILT_IN_STRCAT.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/gimple-fold.c
trunk/gcc/tree.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (7 preceding siblings ...)
2014-01-20 18:18 ` jakub at gcc dot gnu.org
@ 2014-01-20 18:20 ` jakub at gcc dot gnu.org
2014-01-21 7:28 ` jakub at gcc dot gnu.org
2014-01-21 7:32 ` jakub at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-20 18:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Mon Jan 20 18:19:54 2014
New Revision: 206849
URL: http://gcc.gnu.org/viewcvs?rev=206849&root=gcc&view=rev
Log:
PR middle-end/59860
* tree.h (fold_builtin_strcat): New prototype.
* builtins.c (fold_builtin_strcat): No longer static. Add len
argument, if non-NULL, don't call c_strlen. Optimize
directly into __builtin_memcpy instead of __builtin_strcpy.
(fold_builtin_2): Adjust fold_builtin_strcat caller.
* gimple-fold.c (gimple_fold_builtin): Handle BUILT_IN_STRCAT.
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/builtins.c
branches/gcc-4_8-branch/gcc/gimple-fold.c
branches/gcc-4_8-branch/gcc/tree.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (8 preceding siblings ...)
2014-01-20 18:20 ` jakub at gcc dot gnu.org
@ 2014-01-21 7:28 ` jakub at gcc dot gnu.org
2014-01-21 7:32 ` jakub at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-21 7:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Jan 21 07:28:10 2014
New Revision: 206868
URL: http://gcc.gnu.org/viewcvs?rev=206868&root=gcc&view=rev
Log:
PR middle-end/59860
* gcc.dg/strlenopt-4.c: Expect the same counts on s390*-* as on all
other targets.
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/strlenopt-4.c
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/59860] [4.8/4.9 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
` (9 preceding siblings ...)
2014-01-21 7:28 ` jakub at gcc dot gnu.org
@ 2014-01-21 7:32 ` jakub at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-21 7:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59860
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Jan 21 07:31:49 2014
New Revision: 206869
URL: http://gcc.gnu.org/viewcvs?rev=206869&root=gcc&view=rev
Log:
PR middle-end/59860
* gcc.dg/strlenopt-4.c: Expect the same counts on s390*-* as on all
other targets.
Modified:
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/strlenopt-4.c
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-01-21 7:32 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-17 14:01 [Bug tree-optimization/59860] New: [4.8 Regression] ICE in compute_may_aliases, at tree-ssa-structalias.c:6843 rguenth at gcc dot gnu.org
2014-01-17 14:02 ` [Bug tree-optimization/59860] " rguenth at gcc dot gnu.org
2014-01-17 14:28 ` [Bug tree-optimization/59860] [4.8/4.9 " rguenth at gcc dot gnu.org
2014-01-17 14:34 ` rguenth at gcc dot gnu.org
2014-01-19 14:55 ` rguenth at gcc dot gnu.org
2014-01-20 11:02 ` rguenth at gcc dot gnu.org
2014-01-20 11:06 ` rguenth at gcc dot gnu.org
2014-01-20 11:06 ` rguenth at gcc dot gnu.org
2014-01-20 18:18 ` jakub at gcc dot gnu.org
2014-01-20 18:20 ` jakub at gcc dot gnu.org
2014-01-21 7:28 ` jakub at gcc dot gnu.org
2014-01-21 7:32 ` jakub at gcc dot gnu.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).