cvt.c (cp_convert_to_pointer): Call force_fit_type for null pointers.
* cvt.c (cp_convert_to_pointer): Call force_fit_type for null pointers. From-SVN: r55272
This commit is contained in:
parent
4c8aed1419
commit
212e17fd89
3 changed files with 19 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
2002-07-05 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* cvt.c (cp_convert_to_pointer): Call force_fit_type for null
|
||||
pointers.
|
||||
|
||||
PR optimization/7145
|
||||
* tree.c (cp_copy_res_decl_for_inlining): Also copy DECL_INITIAL.
|
||||
|
||||
|
|
|
@ -252,6 +252,8 @@ cp_convert_to_pointer (type, expr, force)
|
|||
else
|
||||
expr = build_int_2 (0, 0);
|
||||
TREE_TYPE (expr) = type;
|
||||
/* Fix up the representation of -1 if appropriate. */
|
||||
force_fit_type (expr, 0);
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
|
14
gcc/testsuite/g++.dg/other/ptrmem3.C
Normal file
14
gcc/testsuite/g++.dg/other/ptrmem3.C
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Bug: The double cast had an TREE_INT_CST_HIGH of 0, while the single
|
||||
// cast had -1, so the comparison failed.
|
||||
|
||||
// { dg-do run }
|
||||
|
||||
struct A { };
|
||||
|
||||
typedef int A::* aip;
|
||||
typedef long A::* alp;
|
||||
|
||||
int main()
|
||||
{
|
||||
return ((aip)(alp)0 != (aip)0);
|
||||
}
|
Loading…
Add table
Reference in a new issue