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]

[Bug tree-optimization] Fix for PR71994


Hi,

For testcase in pr71994, type of bb conditional result and the type of the PHI stmt are different (as om.0_1 is int and the first PHI argument is _bool; PHI stmt uses a constant zero that comes from edge 2). Therefore when we optimize final range test stmt, we end up setting integer 1 for other PHI argument. This results in ICE.

  <bb 2>:
  om.0_1 = om;
  _2 = om.0_1 >= 0;
  int _3 = (int) _2;
  if (om.0_1 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  int _4 = om.0_1 & _3;
  _Bool _12 = _4 != 0;
  <bb 4>:

  # _Bool _13 = PHI <0(2), _12(3)>


IMHO, the fix should be that, we should check the type before replacing the value (punt otherwise). Attached patch does that. Bootstrapped and regression tested on x86_64-linux-gnu with no new regressions. Is this OK for trunk?

Thanks,
Kugan

gcc/testsuite/ChangeLog:

2016-07-26  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* gcc.dg/torture/pr71994.c: New test.

gcc/ChangeLog:

2016-07-26  Kugan Vivekanandarajah  <kuganv@linaro.org>

* tree-ssa-reassoc.c (maybe_optimize_range_tests): Check type compatibility.

Attachment: pr71994.txt
Description: Text document


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