This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR 61340] Add default label to two switches on enum ipa_ref_use
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 3 Jun 2014 21:13:41 +0200
- Subject: Re: [PATCH, PR 61340] Add default label to two switches on enum ipa_ref_use
- Authentication-results: sourceware.org; auth=none
- References: <20140603160056 dot GC18456 at virgil dot suse>
> Hi,
>
> in PR 61340 it has been reported that clang warns about unhandeld enum
> values in a switch (gcc does not, I guess I'll open a new PR for
> that).
>
> Fixed thusly by adding a default label with a gcc_unreachable() in
> both. The potentially unhandled enum value in both cases is
> IPA_REF_ALIAS which we cannot encounter because
>
> 1) in ipa-pure-const.c we are not processing aliases and
>
> 2) in ipa-reference.c we analyze references of a function to a
> variable and that cannot be an alias.
>
> OK for trunk?
OK,
thanks!
Honza
>
> Thanks,
>
> Martin
>
>
> 2014-06-03 Martin Jambor <mjambor@suse.cz>
>
> PR ipa/61340
> * ipa-pure-const.c (propagate_pure_const): Add unreachable default
> handler for switch on an ipa_ref_use enum.
> * ipa-reference.c (analyze_function): Likewise.
>
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index 0ebfe5d..b9a3d3e 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1286,6 +1286,8 @@ propagate_pure_const (void)
> break;
> case IPA_REF_ADDR:
> break;
> + default:
> + gcc_unreachable ();
> }
> better_state (&ref_state, &ref_looping,
> w_l->state_previously_known,
> diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
> index ebff60c..bc58cfa 100644
> --- a/gcc/ipa-reference.c
> +++ b/gcc/ipa-reference.c
> @@ -483,6 +483,8 @@ analyze_function (struct cgraph_node *fn)
> break;
> case IPA_REF_ADDR:
> break;
> + default:
> + gcc_unreachable ();
> }
> }
>
>