This is the mail archive of the gcc-bugs@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/23659] New: Should able to add dereferencing (statements with VUSE) without rerunning may_alias


An example of this comes from PR 18298:
extern "C" int strcmp (const char*, const char*);

char s[2048] = "a";

inline bool foo(const char *str) {
  return !strcmp(s,str);
}
int main() {
  while(!(foo(""))) {
    s[0] = '\0';
  }
  return 0;
}

In fab, we replace:
  #   VUSE <s_1>;
  D.1754_4 = strcmp (&s[0], &""[0]);

With   
  D.1777_6 = (const unsigned char *) &s[0];
  D.1778_9 = *D.1777_6;
  D.1779_3 = (int) D.1778_9;
  D.1754_4 = D.1779_3;

And the "  D.1778_9 = *D.1777_6;" statement does not have a VUSE which causes wrong code if we 
have a V_MAY_DEF/V_MUST_DEF above (which happens in the testcase).

The main reason why I am asking this question so that in the tree combiner, I don't want to rerun 
may_alias after each time I run the tree combiner which just becomes too expensive.

An example for the tree combiner would be:
int f(char *a)
{
  int b = strlen(a);
  return b == 0;
}

-- 
           Summary: Should able to add dereferencing (statements with VUSE)
                    without rerunning may_alias
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: dnovillo at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23659


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