-Og bug? (was: [PATCH] libsanitizer demangling using cp-demangle.c)

Ian Lance Taylor iant@google.com
Tue Jan 28 14:52:00 GMT 2014


On Tue, Jan 28, 2014 at 6:36 AM, Thomas Schwinge
<thomas@codesourcery.com> wrote:
> Avoid "'dc' may be uninitialized" warning.
>
>         libiberty/
>         * cp-demangle.c (d_demangle_callback): Put __builtin_unreachable
>         in place, to help the compiler.
>
> --- libiberty/cp-demangle.c
> +++ libiberty/cp-demangle.c
> @@ -5824,6 +5824,8 @@ d_demangle_callback (const char *mangled, int options,
>                           NULL);
>         d_advance (&di, strlen (d_str (&di)));
>         break;
> +      default:
> +       __builtin_unreachable ();

You can't call __builtin_unreachable in this code, because libiberty
in stage 1 will be compiled by the host compiler and
__builtin_unreachable is specific to GCC.

This patch is OK if you call abort instead of __builtin_unreachable.

Thanks.

Ian



More information about the Gcc-patches mailing list