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

[Bug fortran/46945] [4.6 Regression] gfortran.dg/unpack_zerosize_1.f90 FAILs with -ftree-vrp -fno-tree-ccp -fno-tree-fre


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46945

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-15 11:15:30 UTC ---
The problem is probably that the -1 in
D.1556 = ((logical(kind=4)) __builtin_expect ((<unnamed-unsigned:64>) D.1555 >
-1, 0) ? 1 : 0) + D.1554;
has TREE_OVERFLOW set, D.1555 is determined by VRP to be 0 and from the
overflowed constant VRP determines that 0 > -1 (the type of both is
sizetype, i.e. unsigned, but with the weirdo semantics).
This is created in gfc_array_init_size:
4160      /* First check for overflow. Since an array of type character can
4161         have zero element_size, we must check for that before
4162         dividing.  */
4163      tmp = fold_build2_loc (input_location, TRUNC_DIV_EXPR, 
4164                 sizetype, 
4165                 TYPE_MAX_VALUE (sizetype), element_size);
4166      tmp = fold_build3_loc (input_location, COND_EXPR, integer_type_node,
4167                 gfc_unlikely (fold_build2_loc (input_location, LT_EXPR, 
4168                                boolean_type_node, tmp, 
4169                                stride)),
4170                 integer_one_node, integer_zero_node);

I'd say it is very questionable to use sizetype here.


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