This is the mail archive of the gcc-patches@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]

Re: ibits


Jerry DeLisle wrote:
Steve Kargl wrote:
On Tue, Jan 02, 2007 at 12:48:34PM -0800, Steve Kargl wrote:
On Tue, Jan 02, 2007 at 12:30:44PM -0800, Steve Kargl wrote:
I'm guessing that the code in the Fortran frontend that translates
IBITS is missing a fold_convert such that ~(-1 << 32) is interpreted
as a 32-bit quantity.

This patch fixes the problem.

Index: trans-intrinsic.c
===================================================================
--- trans-intrinsic.c (revision 120314)
+++ trans-intrinsic.c (working copy)
@@ -2332,6 +2349,7 @@ gfc_conv_intrinsic_ibits (gfc_se * se, g
type = TREE_TYPE (arg);
mask = build_int_cst (NULL_TREE, -1);
+ mask = fold_convert (type, mask);
mask = build2 (LSHIFT_EXPR, type, mask, arg3);
mask = build1 (BIT_NOT_EXPR, type, mask);

A better patch is to simply use build_int_cst (type, -1) instead of the fold_convert.

I will get this tested and committed for you tonight, and 4.2 branch in a day.

Jerry


Regression tested and committed on 4.3.


Regression tested and committed on 4.2

by me for Steve Kargl

Jerry


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