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 18298, add another may_alias pass


Since fold_builtins could create arbitrary GIMPLE and add extra loads
which we did not know the aliasing info for before, we have to run a
may_alias pass after running pass_fold_builtins.  I added a FIXME as
requested by Diego when he approved my patch in the PR.

Bootstrapped and tested on ppc-darwin. Approval was in the PR.


Thanks, Andrew Pinski

ChangeLog:

	* tree-optimize.c (init_tree_optimization_passes): Add a may_alias
	pass right after fold builtins.

Testcase:
#include <stdbool.h>
#include <stdlib.h>
int strcmp (const char*, const char*);
char s[2048] = "a";
inline bool foo(const char *str) {
  return !strcmp(s,str);
}
int main() {
int i = 0;
  while(!(foo(""))) {
    i ++;
    s[0] = '\0';
    if (i>2)
     abort ();
  }
  return 0;
}

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