From ed9e916d05ee9ec206bf7a8cfd57c72972f9f460 Mon Sep 17 00:00:00 2001 From: pinskia Date: Thu, 9 Aug 2007 21:39:08 +0000 Subject: [PATCH] 2007-08-09 Andrew Pinski PR c/32796 * c-typeck.c (build_binary_op): Check for non pointer types before calling int_fits_type_p. 2007-08-09 Andrew Pinski PR c/32796 * gcc.c-torture/compile/pr32796.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127323 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/c-typeck.c | 10 ++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr32796.c | 6 ++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32796.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 410cf54..25fb6ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2007-08-09 Andrew Pinski + PR c/32796 + * c-typeck.c (build_binary_op): Check for non pointer types before + calling int_fits_type_p. + +2007-08-09 Andrew Pinski + PR middle-end/32813 * fold-const.c (omit_one_operand): Return only the ommitted expression if the result is an empty statement. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 3e209e2..6964e75 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -8226,8 +8226,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, < TYPE_PRECISION (result_type)) && (type = c_common_signed_or_unsigned_type (unsigned1, - TREE_TYPE (arg1)), - int_fits_type_p (arg0, type))) + TREE_TYPE (arg1))) + && !POINTER_TYPE_P (type) + && int_fits_type_p (arg0, type)) result_type = type; else if (TREE_CODE (arg1) == INTEGER_CST && (unsigned0 || !uns) @@ -8235,8 +8236,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, < TYPE_PRECISION (result_type)) && (type = c_common_signed_or_unsigned_type (unsigned0, - TREE_TYPE (arg0)), - int_fits_type_p (arg1, type))) + TREE_TYPE (arg0))) + && !POINTER_TYPE_P (type) + && int_fits_type_p (arg1, type)) result_type = type; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06b2fff..2659bb2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2007-08-09 Andrew Pinski + PR c/32796 + * gcc.c-torture/compile/pr32796.c: New test. + +2007-08-09 Andrew Pinski + PR middle-end/32813 * gfortran.fortran-torture/compile/emptyif-1.f90: New test. * lib/fortran-torture.exp (fortran-torture): Use TORTURE_OPTIONS instead diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32796.c b/gcc/testsuite/gcc.c-torture/compile/pr32796.c new file mode 100644 index 0000000..9e0abfb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32796.c @@ -0,0 +1,6 @@ + + +__SIZE_TYPE__ f (void *ptr) +{ + return ((__SIZE_TYPE__)(ptr)-1) | 1ULL; +} -- 2.7.4