public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code
@ 2013-04-04 7:39 pmblakely at googlemail dot com
2013-04-04 7:40 ` [Bug tree-optimization/56837] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pmblakely at googlemail dot com @ 2013-04-04 7:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56837
Bug #: 56837
Summary: -ftree-loop-distribute-patterns generates incorrect
code
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pmblakely@googlemail.com
Created attachment 29801
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29801
Compilation output from adding -v -save-temps
With gcc-4.8.0 release, and up to and including gcc-4.8-20130328,
-ftree-loop-distribute-patterns can give incorrect results:
Minimal test-case (named OptBug-4.8.C):
extern int __builtin_printf (__const char *__restrict __format, ...);
int main(void)
{
bool* b = new bool[5];
for(unsigned int i=0 ; i < 5 ; i++)
{
b[i] = true;
}
for(unsigned int i=0 ; i < 5 ; i++)
{
__builtin_printf("%d\n", b[i]);
}
return 0;
}
Compilation command: g++-4.8-20130328 OptBug-4.8.C -o OptBug-4.8 -O1
-ftree-loop-distribute-patterns
Expected output:
1
1
1
1
1
Actual output:
255
255
255
255
255
The expected output is produced if the -ftree-loop-distribute-patterns flag is
removed.
The incorrect behaviour is not exhibited by gcc-4.7.2.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56837] -ftree-loop-distribute-patterns generates incorrect code
2013-04-04 7:39 [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code pmblakely at googlemail dot com
@ 2013-04-04 7:40 ` pinskia at gcc dot gnu.org
2013-04-04 7:57 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-04-04 7:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56837
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Severity|major |normal
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56837] -ftree-loop-distribute-patterns generates incorrect code
2013-04-04 7:39 [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code pmblakely at googlemail dot com
2013-04-04 7:40 ` [Bug tree-optimization/56837] " pinskia at gcc dot gnu.org
@ 2013-04-04 7:57 ` mpolacek at gcc dot gnu.org
2013-04-04 7:58 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-04-04 7:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56837
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-04-04 07:57:14 UTC ---
That's because .ldist substitutes the first loop with __builtin_memset (b_7,
-1, 5);
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56837] -ftree-loop-distribute-patterns generates incorrect code
2013-04-04 7:39 [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code pmblakely at googlemail dot com
2013-04-04 7:40 ` [Bug tree-optimization/56837] " pinskia at gcc dot gnu.org
2013-04-04 7:57 ` mpolacek at gcc dot gnu.org
@ 2013-04-04 7:58 ` rguenth at gcc dot gnu.org
2013-04-04 8:32 ` rguenth at gcc dot gnu.org
2013-04-04 11:01 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-04 7:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56837
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2013-04-04
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-04 07:58:19 UTC ---
Eh. Mine.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56837] -ftree-loop-distribute-patterns generates incorrect code
2013-04-04 7:39 [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code pmblakely at googlemail dot com
` (2 preceding siblings ...)
2013-04-04 7:58 ` rguenth at gcc dot gnu.org
@ 2013-04-04 8:32 ` rguenth at gcc dot gnu.org
2013-04-04 11:01 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-04 8:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56837
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-04 08:32:35 UTC ---
Testcase
extern "C" void abort (void);
extern "C" int memcmp (const void *, const void *, __SIZE_TYPE__);
bool b1[8];
bool b2[8] = { true, true, true, true, true, true, true, true };
int main()
{
unsigned int i;
for(i=0 ; i < 8; i++)
b1[i] = true;
if (memcmp (b1, b2, 8) != 0)
abort ();
return 0;
}
I have a patch.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56837] -ftree-loop-distribute-patterns generates incorrect code
2013-04-04 7:39 [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code pmblakely at googlemail dot com
` (3 preceding siblings ...)
2013-04-04 8:32 ` rguenth at gcc dot gnu.org
@ 2013-04-04 11:01 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-04 11:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56837
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-04 11:01:51 UTC ---
Author: rguenth
Date: Thu Apr 4 10:55:25 2013
New Revision: 197476
URL: http://gcc.gnu.org/viewcvs?rev=197476&root=gcc&view=rev
Log:
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56837
* tree-loop-distribution.c (classify_partition): For non-zero
values require that the value has the same precision as its
mode to be useful as memset value.
* g++.dg/torture/pr56837.C: New testcase.
Added:
trunk/gcc/testsuite/g++.dg/torture/pr56837.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-loop-distribution.c
Author: rguenth
Date: Thu Apr 4 11:00:45 2013
New Revision: 197477
URL: http://gcc.gnu.org/viewcvs?rev=197477&root=gcc&view=rev
Log:
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56837
* tree-loop-distribution.c (classify_partition): For non-zero
values require that the value has the same precision as its
mode to be useful as memset value.
* g++.dg/torture/pr56837.C: New testcase.
Added:
branches/gcc-4_8-branch/gcc/testsuite/g++.dg/torture/pr56837.C
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
branches/gcc-4_8-branch/gcc/tree-loop-distribution.c
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-04-04 11:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 7:39 [Bug tree-optimization/56837] New: -ftree-loop-distribute-patterns generates incorrect code pmblakely at googlemail dot com
2013-04-04 7:40 ` [Bug tree-optimization/56837] " pinskia at gcc dot gnu.org
2013-04-04 7:57 ` mpolacek at gcc dot gnu.org
2013-04-04 7:58 ` rguenth at gcc dot gnu.org
2013-04-04 8:32 ` rguenth at gcc dot gnu.org
2013-04-04 11:01 ` 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).