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 optimization/14728] New: [tree-ssa] missed jump threading due to casts


Because of ABI requirements, functions with _Bool (and other types smaller than int) 
return types are returned as int so the tree optimizers do not optimize the following 
functions by getting rid of the call to link_error:
inline static _Bool f(int i, int j)
{
  return i==j;
}
int link_error(void);
int l(int i, int j)
{
  if (f (i,j))
    {
      if (i == j)
        return 0;
      else
        return link_error();
    }
  return 0;
}
int main()
{
  return l(1, 2);
}

I have a patch to fix this, this is just for me to remind myself to submit it when the tree-ssa 
gets merged into the mainline, this patch also helps C++ code as they do small functions 
which return bools all the time.

-- 
           Summary: [tree-ssa] missed jump threading due to casts
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: pinskia 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=14728


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