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 PR middle-end/22429, fold building tree which depends on signed overflow


The problem here is fold (build_range_check) converts
"-1073741824 <= n && n <= 1073741823" to "n + 1073741824 >= 0" which makes
depends on signed overflow being defined. Fold later converts it to
"n >= -1073741824" by my recent patch which is wrong. This patch fixes
the problem by using unsigned types if signed overflow is undefined.


OK? Bootstrapped and tested on x86_64-pc-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

	* fold-const.c (build_range_check): Use unsigned when signed
	overflow is undefined also.  If etype is subtype, make sure that
	the subtraction is in the supper type.

Attachment: t.7.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]