This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix a couple of fold checking bugs


There are two problems here.
First is on types TYPE_CONTAINS_PLACEHOLDER_INTERNAL is allowed to change,
it is just a cache, the problem can be see with the following C++ code:
int
__finite (double __x) throw ()
{
return (__extension__
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
| 0x800fffffu) + 1) >> 31));
}


Note this is also a 4.0 regression.

The second is that we could just blow the stack right out for TREE_LIST
with constructors of huge arrays. This is seen in a bootstrap on
powerpc-darwin when building insn-attrtab.o in stage2. The way to fix this
is to add a label and make us do tail recursion by hand.


OK for the mainline and for 4.0.1 after
4.0 branches reopen? Bootstrapped and tested on
powerpc-darwin.

Thanks,
Andrew Pinski

ChangeLog:
	PR middle-end/20931
	PR middle-end/20946
	* fold-const.c (fold_checksum_tree): Copy types also if
	TYPE_CONTAINS_PLACEHOLDER_INTERNAL is set.
	Don't call fold_checksum_tree for TREE_LIST's TREE_CHAIN
	first.
	Tail recurse TREE_LIST's TREE_CHAIN.


Attachment: temp1.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]