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]

[Committed] Fix PR middle-end/32780 ICE due to type mismatch and pointers


Hi,
  Even though the ICE comes originally when the merge of pointer plus,
this is really a type mismatch issue as shown by compiling with type
checking (which is enabled in stage1):
t.c: In function 'crashGcc':
t.c:6: error: type mismatch in binary expression
long unsigned int
char *
long unsigned int
b = a & 4294967294

This patch fixes the type mismatch caused by folding of  A - (A & B)
into ~B & A (which is used to align a pointer), we forgot to cast back
some of the operands (as we had stripped their cast before).

Committed as obvious after a bootstrap/test on i686-apple-darwin8.10
with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

* fold-const.c (fold_binary <case MINUS_EXPR>): Fix the type of operands
for the folding of "A - (A & B)" into "~B & A"; cast them to type.

* gcc.c-torture/compile/pr32780.c: New test

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