Commit 0e4b00d6 by Andrew Pinski Committed by Andrew Pinski

ptrmemfield.C: New testcase.

2008-07-05  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        * g++.dg/tree-ssa/ptrmemfield.C: New testcase.

2008-07-05  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        * fold-const.c (fold_convert_const): Treat OFFSET_TYPE the same as
        integral and pointer types.

From-SVN: r137510
parent 6e1fab3d
2008-07-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
* fold-const.c (fold_convert_const): Treat OFFSET_TYPE the same as
integral and pointer types.
2008-07-04 Roger Sayle <roger@eyesopen.com> 2008-07-04 Roger Sayle <roger@eyesopen.com>
* config/rs6000/host-darwin.c (darwin_rs6000_extra_siganls): Cast * config/rs6000/host-darwin.c (darwin_rs6000_extra_siganls): Cast
......
...@@ -2396,7 +2396,8 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) ...@@ -2396,7 +2396,8 @@ fold_convert_const (enum tree_code code, tree type, tree arg1)
if (TREE_TYPE (arg1) == type) if (TREE_TYPE (arg1) == type)
return arg1; return arg1;
if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type)) if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type)
|| TREE_CODE (type) == OFFSET_TYPE)
{ {
if (TREE_CODE (arg1) == INTEGER_CST) if (TREE_CODE (arg1) == INTEGER_CST)
return fold_convert_const_int_from_int (type, arg1); return fold_convert_const_int_from_int (type, arg1);
......
2008-07-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
* g++.dg/tree-ssa/ptrmemfield.C: New testcase.
2008-07-05 Joseph Myers <joseph@codesourcery.com> 2008-07-05 Joseph Myers <joseph@codesourcery.com>
* lib/gcc-dg.exp (remove-build-file): Remove files on remote host * lib/gcc-dg.exp (remove-build-file): Remove files on remote host
......
/* { dg-do compile } */
// { dg-options "-O2 -fdump-tree-final_cleanup" }
struct f
{
char m;
char m1;
};
static inline char f:: *g(int a)
{
return a?0:&f::m;
}
int h(void)
{
char f:: *a = g(0);
return a == 0;
}
/* We should have no cast to offset_type. */
/* { dg-final { scan-tree-dump-times "offset_type" 0 "final_cleanup"} } */
// And we should optimized this code to just return 0
/* { dg-final { scan-tree-dump-times "return 0" 1 "final_cleanup"} } */
/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment