[Bug fortran/92896] [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283

2019-12-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92896

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||tkoenig at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #7 from Thomas Koenig  ---
(In reply to MarkEggleston from comment #6)
> This has been fixed, see comment 5.
> 
> I do not have permission to changes the status so somebody that does will
> need to do so.

Fixing, then.

Thanks for the patch!

[Bug fortran/92896] [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283

2019-12-19 Thread mark.eggleston at codethink dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92896

--- Comment #6 from MarkEggleston  ---
This has been fixed, see comment 5.

I do not have permission to changes the status so somebody that does will need
to do so.

[Bug fortran/92896] [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283

2019-12-19 Thread markeggleston at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92896

--- Comment #5 from markeggleston at gcc dot gnu.org ---
Author: markeggleston
Date: Thu Dec 19 15:13:25 2019
New Revision: 279583

URL: https://gcc.gnu.org/viewcvs?rev=279583=gcc=rev
Log:
Prevent conversion of character data in array constructors.

Fix for PR fortran/92896 [10 Regression] [DEC] ICE in reduce_unary, at
fortran/arith.c:1283.

This was caused by an unintended side affect of "Allow CHARACTER literals
in assignments and data statements" (revision 277975). If the conversion
occurs in a array constructor it is rejected.


Added:
trunk/gcc/testsuite/gfortran.dg/no_char_conversion_in_array_constructor.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/array.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/intrinsic.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/92896] [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283

2019-12-11 Thread mark.eggleston at codethink dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92896

--- Comment #4 from MarkEggleston  ---
reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op,
  gfc_expr **result)
{
  gfc_constructor_base head;
  gfc_constructor *c;
  gfc_expr *r;
  arith rc;

  if (op->expr_type == EXPR_CONSTANT)
return eval (op, result);

  rc = ARITH_OK;
  head = gfc_constructor_copy (op->value.constructor);
  for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c))
{
  rc = reduce_unary (eval, c->expr, );

  if (rc != ARITH_OK)
break;

  gfc_replace_expr (c->expr, r);
}

  if (rc != ARITH_OK)
gfc_constructor_free (head);
  else
{
  gfc_constructor *c = gfc_constructor_first (head);

!!! Crashes because c is NULL

  r = gfc_get_array_expr (c->expr->ts.type, c->expr->ts.kind,
  >where);  r->shape = gfc_copy_shape
(op->shape, op->rank);
  r->rank = op->rank;
  r->value.constructor = head;
  *result = r;
}

  return rc;
}


The ICE is indicated above. The routine is called, then called again
recursively, it would seem that the constructor is missing when
-fno-range-check is omitted.  Judging by comments 1 & 3 there is a missing
error message.

[Bug fortran/92896] [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283

2019-12-11 Thread mark.eggleston at codethink dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92896

--- Comment #3 from MarkEggleston  ---
The value 'A' is padded out with spaces giving a value 2314885530818453554.
Avoiding the conversion and using the value directly:

program p
   print *, [integer :: 1, [integer(8) :: 2314885530818453554]]
end

results in:

2 |print *, [integer :: 1, [integer(8) :: 2314885530818453554]]
  |  1
Error: Integer too big for its kind at (1). This check can be disabled with the
option '-fno-range-check'

[Bug fortran/92896] [10 Regression] [DEC] ICE in reduce_unary, at fortran/arith.c:1283

2019-12-11 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92896

Martin Liška  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-12-11
 CC||mark.eggleston at codethink 
dot co
   ||m, marxin at gcc dot gnu.org
  Known to work||9.2.0
   Target Milestone|--- |10.0
 Ever confirmed|0   |1
  Known to fail||10.0

--- Comment #2 from Martin Liška  ---
Confirmed, started with r277975.