public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
@ 2010-11-18 8:33 jakub at gcc dot gnu.org
2010-11-18 8:47 ` [Bug middle-end/46534] " jakub at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-18 8:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
Summary: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf
("...>10MBstring\n") into puts
Product: gcc
Version: 4.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
/* { dg-do compile } */
/* { dg-options "-O2" } */
#define S1 " "
#define S2 S1 S1 S1 S1 S1 S1 S1 S1 S1 S1
#define S3 S2 S2 S2 S2 S2 S2 S2 S2 S2 S2
#define S4 S3 S3 S3 S3 S3 S3 S3 S3 S3 S3
#define S5 S4 S4 S4 S4 S4 S4 S4 S4 S4 S4
#define S6 S5 S5 S5 S5 S5 S5 S5 S5 S5 S5
#define S7 S6 S6 S6 S6 S6 S6 S6 S6 S6 S6
void
foo (void)
{
__builtin_printf (S7 "\n");
}
ICEs, because printf->puts folding uses XALLOCAVEC for the string literal,
which for very long strings overflows the stack.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
@ 2010-11-18 8:47 ` jakub at gcc dot gnu.org
2010-11-18 10:04 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-18 8:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2010.11.18 08:35:47
Known to work| |3.2.3
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.3.6
Ever Confirmed|0 |1
Known to fail| |3.4.6, 4.4.5, 4.5.1, 4.6.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
2010-11-18 8:47 ` [Bug middle-end/46534] " jakub at gcc dot gnu.org
@ 2010-11-18 10:04 ` jakub at gcc dot gnu.org
2010-11-18 10:24 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-18 10:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-18 08:47:37 UTC ---
Created attachment 22439
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22439
gcc46-pr46534.patch
Untested fix.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
2010-11-18 8:47 ` [Bug middle-end/46534] " jakub at gcc dot gnu.org
2010-11-18 10:04 ` jakub at gcc dot gnu.org
@ 2010-11-18 10:24 ` rguenth at gcc dot gnu.org
2010-11-18 10:26 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-18 10:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-18 10:19:39 UTC ---
Err. Why not avoid the copying completely? build_string will copy it
anyway (and thus so does build_string_literal).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2010-11-18 10:24 ` rguenth at gcc dot gnu.org
@ 2010-11-18 10:26 ` jakub at gcc dot gnu.org
2010-11-18 11:55 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-18 10:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-18 10:25:21 UTC ---
Because it needs to modify it first (overwrite '\n' with '\0').
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2010-11-18 10:26 ` jakub at gcc dot gnu.org
@ 2010-11-18 11:55 ` rguenth at gcc dot gnu.org
2010-11-18 21:08 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-18 11:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-18 11:52:48 UTC ---
(In reply to comment #3)
> Because it needs to modify it first (overwrite '\n' with '\0').
?
just pass a proper length, build_string will append a \0, no? That said,
if build_string doesn't work, create a variant that will do. No need
to copy twice. Really.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2010-11-18 11:55 ` rguenth at gcc dot gnu.org
@ 2010-11-18 21:08 ` jakub at gcc dot gnu.org
2010-11-18 22:17 ` [Bug middle-end/46534] [4.3/4.4/4.5 " jakub at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-18 21:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-18 20:51:24 UTC ---
Author: jakub
Date: Thu Nov 18 20:51:19 2010
New Revision: 166918
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166918
Log:
PR middle-end/46534
* builtins.c (fold_builtin_printf): Don't copy and modify string
before build_string_literal, instead modify what
build_string_literal returned.
* gcc.c-torture/compile/pr46534.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr46534.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (5 preceding siblings ...)
2010-11-18 21:08 ` jakub at gcc dot gnu.org
@ 2010-11-18 22:17 ` jakub at gcc dot gnu.org
2010-11-25 16:10 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-18 22:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.6.0
Summary|[4.3/4.4/4.5/4.6 |[4.3/4.4/4.5 Regression]
|Regression] ICE optimizing |ICE optimizing printf
|printf ("...>10MBstring\n") |("...>10MBstring\n") into
|into puts |puts
Known to fail|4.6.0 |
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-18 22:14:09 UTC ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (6 preceding siblings ...)
2010-11-18 22:17 ` [Bug middle-end/46534] [4.3/4.4/4.5 " jakub at gcc dot gnu.org
@ 2010-11-25 16:10 ` rguenth at gcc dot gnu.org
2010-12-07 15:11 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-25 16:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4/4.5 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (7 preceding siblings ...)
2010-11-25 16:10 ` rguenth at gcc dot gnu.org
@ 2010-12-07 15:11 ` jakub at gcc dot gnu.org
2010-12-07 18:57 ` [Bug middle-end/46534] [4.3/4.4 " jakub at gcc dot gnu.org
2011-06-27 12:05 ` [Bug middle-end/46534] [4.3 " rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-07 15:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-07 15:11:49 UTC ---
Author: jakub
Date: Tue Dec 7 15:11:46 2010
New Revision: 167540
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167540
Log:
Backport from mainline
2010-11-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/46534
* builtins.c (fold_builtin_printf): Don't copy and modify string
before build_string_literal, instead modify what
build_string_literal returned.
* gcc.c-torture/compile/pr46534.c: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/compile/pr46534.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/builtins.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3/4.4 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (8 preceding siblings ...)
2010-12-07 15:11 ` jakub at gcc dot gnu.org
@ 2010-12-07 18:57 ` jakub at gcc dot gnu.org
2011-06-27 12:05 ` [Bug middle-end/46534] [4.3 " rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-07 18:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-07 18:57:00 UTC ---
Author: jakub
Date: Tue Dec 7 18:56:56 2010
New Revision: 167558
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167558
Log:
PR middle-end/46534
* builtins.c (expand_builtin_printf): Don't copy and modify string
before build_string_literal, instead modify what
build_string_literal returned.
Backport from mainline
2010-11-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/46534
* builtins.c (fold_builtin_printf): Don't copy and modify string
before build_string_literal, instead modify what
build_string_literal returned.
* gcc.c-torture/compile/pr46534.c: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr46534.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/builtins.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/46534] [4.3 Regression] ICE optimizing printf ("...>10MBstring\n") into puts
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
` (9 preceding siblings ...)
2010-12-07 18:57 ` [Bug middle-end/46534] [4.3/4.4 " jakub at gcc dot gnu.org
@ 2011-06-27 12:05 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27 12:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|4.3.6 |4.4.6
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 12:00:39 UTC ---
Fixed for 4.4.6.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-06-27 12:05 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 8:33 [Bug middle-end/46534] New: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf ("...>10MBstring\n") into puts jakub at gcc dot gnu.org
2010-11-18 8:47 ` [Bug middle-end/46534] " jakub at gcc dot gnu.org
2010-11-18 10:04 ` jakub at gcc dot gnu.org
2010-11-18 10:24 ` rguenth at gcc dot gnu.org
2010-11-18 10:26 ` jakub at gcc dot gnu.org
2010-11-18 11:55 ` rguenth at gcc dot gnu.org
2010-11-18 21:08 ` jakub at gcc dot gnu.org
2010-11-18 22:17 ` [Bug middle-end/46534] [4.3/4.4/4.5 " jakub at gcc dot gnu.org
2010-11-25 16:10 ` rguenth at gcc dot gnu.org
2010-12-07 15:11 ` jakub at gcc dot gnu.org
2010-12-07 18:57 ` [Bug middle-end/46534] [4.3/4.4 " jakub at gcc dot gnu.org
2011-06-27 12:05 ` [Bug middle-end/46534] [4.3 " rguenth 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).