diff mbox

Remove assert in target_handle_option

Message ID Pine.LNX.4.64.1011171124050.29281@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Nov. 17, 2010, 11:25 a.m. UTC
This patch disables the assertion in target_handle_option about the
location of the option, as explained in the comment added.  I hope
this will fix the problems on SH reported in
<http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01623.html>.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* opts.c (target_handle_option): Do not assert that loc ==
	UNKNOWN_LOCATION.

Comments

Richard Biener Nov. 17, 2010, 11:35 a.m. UTC | #1
On Wed, Nov 17, 2010 at 12:25 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> This patch disables the assertion in target_handle_option about the
> location of the option, as explained in the comment added.  I hope
> this will fix the problems on SH reported in
> <http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01623.html>.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit?

Ok.

Thanks,
Richard.

> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * opts.c (target_handle_option): Do not assert that loc ==
>        UNKNOWN_LOCATION.
>
> Index: gcc/opts.c
> ===================================================================
> --- gcc/opts.c  (revision 166795)
> +++ gcc/opts.c  (working copy)
> @@ -521,7 +521,7 @@ target_handle_option (struct gcc_options
>                      struct gcc_options *opts_set,
>                      const struct cl_decoded_option *decoded,
>                      unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
> -                     location_t loc,
> +                     location_t loc ATTRIBUTE_UNUSED,
>                      const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
>                      diagnostic_context *dc)
>  {
> @@ -530,7 +530,10 @@ target_handle_option (struct gcc_options
>   gcc_assert (dc == global_dc);
>   gcc_assert (decoded->canonical_option_num_elements <= 2);
>   gcc_assert (kind == DK_UNSPECIFIED);
> -  gcc_assert (loc == UNKNOWN_LOCATION);
> +  /* Although the location is not passed down to
> +     targetm.handle_option, do not make assertions about its value;
> +     options may come from optimize attributes and having the correct
> +     location in the handler is not generally important.  */
>   return targetm.handle_option (decoded->opt_index, decoded->arg,
>                                decoded->value);
>  }
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>
Kaz Kojima Nov. 17, 2010, 12:07 p.m. UTC | #2
"Joseph S. Myers" <joseph@codesourcery.com> wrote:
> This patch disables the assertion in target_handle_option about the
> location of the option, as explained in the comment added.  I hope
> this will fix the problems on SH reported in
> <http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01623.html>.

With it, problems seen on SH go away.  Thanks!

Regards,
	kaz
diff mbox

Patch

Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 166795)
+++ gcc/opts.c	(working copy)
@@ -521,7 +521,7 @@  target_handle_option (struct gcc_options
 		      struct gcc_options *opts_set,
 		      const struct cl_decoded_option *decoded,
 		      unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
-		      location_t loc,
+		      location_t loc ATTRIBUTE_UNUSED,
 		      const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
 		      diagnostic_context *dc)
 {
@@ -530,7 +530,10 @@  target_handle_option (struct gcc_options
   gcc_assert (dc == global_dc);
   gcc_assert (decoded->canonical_option_num_elements <= 2);
   gcc_assert (kind == DK_UNSPECIFIED);
-  gcc_assert (loc == UNKNOWN_LOCATION);
+  /* Although the location is not passed down to
+     targetm.handle_option, do not make assertions about its value;
+     options may come from optimize attributes and having the correct
+     location in the handler is not generally important.  */
   return targetm.handle_option (decoded->opt_index, decoded->arg,
 				decoded->value);
 }