This is the mail archive of the mailing list for the GNU Fortran 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: [Patch, fortran] PR51870 - [OOP] ICE with ALLOCATE and SOURCE-expr function returning BT_CLASS

Dear Paul,

first, thanks for your patch review. If you have time, could you also have a look at the patch, which fixes an conversion issue (ICE) with the default initializer.

Current regression status:
a) gfortran: Today, one fixed, two new ones. (i) [4.7] -ffrontend-optimize (PR51958), (ii) [4.6/4.7] ICE in gfc_conv_array_constructor_expr (PR51966). Total number: 8.
b) GCC as a whole: 85 serious - 7 P1, 66 P2, 12 P3; 65 P4, 55 P5.

Paul Richard Thomas wrote:
The attached is where I got to:

>  +         /* This is the safest way of converting to a compatible
>  +            type for use in the allocation.  */
>  +         tmp = TYPE_SIZE_UNIT (TREE_TYPE (gfc_index_zero_node));
>  +         memsz = fold_convert (TREE_TYPE (tmp), memsz);
memsz = fold_convert (gfc_charlen_type_node, memsz); works fine.

That looks wrong. I think you need "sizetype". A gfc_charlen_type_node is a (signed) INTEGER(4).

On many systems, a sizetype is "unsigned int" - thus, ignoring the signess, gfc_charlen_type_node should work. In particular, many Linux systems and in particular x86-64 and i386 have "unsigned int".

However, there are plenty of systems which use "long unsigned int". I would expect that your gfc_charlen_type_node will break on the following systems - some of them have rather active gfortran users:

On Alpha (OSF5, OpenBSD), on Arm (if TARGET_AAPCS_BASED is false), on AVR (if INT_TYPE_SIZE == 8 ), on Darwin, on Epiphany, on 64bit Cygwin/MinGW and 64bit BSD, TARGET_LP64 systems, TARGET_64BIT FreeBSD, djgpp, openbsdelf, SYSv4 ia64, m32c/m32r, m68k-(Free,Open)BSD, m68kemb, Mips (with POINTER_SIZE == 64, BSD or sde), PA-64-hpux, TARGET_64BIT RS6000, rx, s390 (only TARGET_64BIT), TARGET_SH5, Sparc (BSD or TARGET_ARCH64), VAX.

I did a bit of testing but only glanced at the patch. Thanks for the improvements!


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