2016-12-10 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/78758
+ * tree-object-size.c (compute_object_offset) <case ARRAY_REF>: Handle
+ non-zero low bound or non-standard element sizes.
+
PR sanitizer/78708
* lto-streamer-in.c (input_function): In addition to debug stmts
without -g, remove IFN_*SAN_* calls if corresponding flag_sanitize
+2016-12-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/78758
+ * gfortran.dg/pr78758.f90: New test.
+ * gfortran.dg/pr38868.f: Remove again bogus warning.
+
2016-12-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77903
--- /dev/null
+! PR fortran/78758
+! { dg-do compile }
+! { dg-options "-O2 -Wall" }
+
+integer function pr78758 (x)
+ character(len=*), intent(in) :: x
+ character(len=16) :: y
+ integer, external :: z
+ y(2:) = " " // adjustl (x(2:))
+ pr78758 = z (y)
+end function pr78758
return base;
t = TREE_OPERAND (expr, 1);
+ tree low_bound, unit_size;
+ low_bound = array_ref_low_bound (CONST_CAST_TREE (expr));
+ unit_size = array_ref_element_size (CONST_CAST_TREE (expr));
+ if (! integer_zerop (low_bound))
+ t = fold_build2 (MINUS_EXPR, TREE_TYPE (t), t, low_bound);
if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) < 0)
{
code = MINUS_EXPR;
t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
}
t = fold_convert (sizetype, t);
- off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
+ off = size_binop (MULT_EXPR, unit_size, t);
break;
case MEM_REF: