Commit 37e10165 by Teresa Johnson Committed by Teresa Johnson

re PR tree-optimization/63841 (Incorrect strlen optimization after complete unroll)

2014-11-13  Teresa Johnson  <tejohnson@google.com>

gcc:
	PR tree-optimization/63841
	* tree.c (initializer_zerop): A clobber does not zero initialize.

gcc/testsuite:
	PR tree-optimization/63841
	* g++.dg/tree-ssa/pr63841.C: New test.

From-SVN: r217505
parent 6fad471b
2014-11-13 Teresa Johnson <tejohnson@google.com>
PR tree-optimization/63841
* tree.c (initializer_zerop): A clobber does not zero initialize.
2014-11-13 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* optabs.c (prepare_operand): Gracefully fail if the mode of X
2014-11-13 Teresa Johnson <tejohnson@google.com>
PR tree-optimization/63841
* g++.dg/tree-ssa/pr63841.C: New test.
2014-11-13 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/forwprop-28.c: Adjust.
......
/* { dg-do run } */
/* { dg-options "-O2" } */
#include <cstdio>
#include <string>
std::string __attribute__ ((noinline)) comp_test_write() {
std::string data;
for (int i = 0; i < 2; ++i) {
char b = 1 >> (i * 8);
data.append(&b, 1);
}
return data;
}
std::string __attribute__ ((noinline)) comp_test_write_good() {
std::string data;
char b;
for (int i = 0; i < 2; ++i) {
b = 1 >> (i * 8);
data.append(&b, 1);
}
return data;
}
int main() {
std::string good = comp_test_write_good();
printf("expected: %hx\n", *(short*)good.c_str());
std::string bad = comp_test_write();
printf("got: %hx\n", *(short*)bad.c_str());
return good != bad;
}
......@@ -10330,6 +10330,8 @@ initializer_zerop (const_tree init)
{
unsigned HOST_WIDE_INT idx;
if (TREE_CLOBBER_P (init))
return false;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), idx, elt)
if (!initializer_zerop (elt))
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment