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: [PATCH] PR fortran/92018 -- BOZ the gift that keeps giving


On Wed, Oct 9, 2019 at 2:14 AM Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> Tested on x86_64-*-freebsd.  OK to commit?
>
> A BOZ literal constant can be an actual argument in a
> very limited number of intrinsic subprograms.  For those
> intrinsics subprograms, the BOZ literal constant is converted
> either during checking (see check.c) or simplification
> (see simplify.c).  In resolve.c (resolve_function), I added
> code that would walk the actual argument list to check for a
> BOZ, but that code was restricted to functions with the EXTERNAL
> attribute.
>
> The new testcase, pr92018.f90, demonstrates a situation
> when neither the INTRINSIC and EXTERNAL attribute is set,
> and the actual argument list contains BOZ.  This led to
> an ICE.  The patch removes the previous restriction, and
> so the actual arguments for all functions are checked.
> This works except it pointed to a deficiency in the checking
> routines.  If something was rejected, (e.g., IAND(Z'12',Z34')),
> the BOZ were passed onto resolve_function() and run-on errors
> were reported.  To avoid these additional error messages, I have
> added the reset_boz() function, which converts a rejected
> BOZ to a default integer kind 0.
>
> 2019-10-09  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>         PF fortran/92018
>         * check.c (reset_boz): New function.
>         (illegal_boz_arg, boz_args_check, gfc_check_complex, gfc_check_float,
>         gfc_check_transfer): Use it.
>         (gfc_check_dshift): Use reset_boz, and re-arrange the checking to
>         help suppress possible run-on errors.
>         (gfc_check_and): Restore checks for valid argument types.  Use
>         reset_boz, and re-arrange the checking to help suppress possible
>         run-on errors.
>         * resolve.c (resolve_function): Actual arguments cannot be BOZ in
>         a function reference.
>
> 2019-10-09  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>         PF fortran/92018
>         * gfortran.dg/gnu_logical_2.f90: Update dg-error regex.
>         * gfortran.dg/pr81509_2.f90: Ditto.
>         * gfortran.dg/pr92018.f90: New test.
>
> --
> Steve

Ok.

-- 
Janne Blomqvist


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