[patch, libgfortran] Bug 91593 - Implicit enum conversions in libgfortran/io/transfer.c

Janne Blomqvist blomqvist.janne@gmail.com
Sat Sep 28 20:21:00 GMT 2019


On Fri, Sep 27, 2019 at 8:14 PM Jerry DeLisle <jvdelisle@charter.net> wrote:
>
> On 9/23/19 8:12 PM, Jerry DeLisle wrote:
> > On 9/23/19 8:52 AM, Bernhard Reutner-Fischer wrote:
> >> On 22 September 2019 22:51:46 CEST, Jerry DeLisle <jvdelisle@charter.net> wrote:
> >>> Hi all,
> >>>
> >>> The attached patch eliminates several warnings by adjusting which
> >>> enumerator is
> >>> used in the subject offending code. I fixed this by adding an
> >>> enumerator at the
> >>> end of the file_mode definition.  This then triggered a warning in
> >>> several other
> >>> places for an unhandled case in the switch statements. I cleared those
> >>> by
> >>> throwing in an assert (false) since it cant happen unless something
> >>> really goes
> >>> wrong somehow.
> >>>
> >> I'm curious why you assert (false) instead of the usual gcc_unreachable ()?
> >>
> >> Thanks,
> >>
> >
> > Because I forgot all about gcc_unreachable.  I will give it a try.
> >
> > Jerry
>
> gcc_unreachable is only defined in the gfortran frontend and not the runtime.
> Therefore, I added a define to io.h which invokes __builtin_unreachable and does
> not use fancy_abort. I don't think we need anything fancy.
>
> If no objections, I will commit the attached updated patch with a new ChangeLog.

Just a minor nit, why bother with the #define, why not just use
__builtin_unreachable directly?

(I think for the frontend there's the argument that it might be
compiled with a non-GCC compiler which might not support
__builtin_unreachable. But libgfortran is always compiled with the
corresponding gcc frontend, so this doesn't apply there.)

-- 
Janne Blomqvist



More information about the Gcc-patches mailing list