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, MIPS]: Fix internal compiler error: in check_bool_attrs, at recog.c:2218 for micromips attribute


> This patch fixes an internal compiler error when micromips/nomicromips
> attributes are used.
> 
> The problem here was that the cached boolean attributes for the current
> target did not agree with the uncached attributes throwing an assertion
> error.
> 
> It appears that saving and restoring the state for micromips was
> missing, just like there is for mips16. OK to apply?

Just to check, the reason we don't see this in the current testsuite is that
there is no test with both MIPS and microMIPS functions?

> gcc/
> 	* config/mips/mips.c (micromips_globals): New variable.
> 	(mips_set_compression_mode): Save and reinitialize target-dependent
> 	state for microMIPS.
> 
> gcc/testsuite
> 	* gcc.target/mips/umips-attr.c: New test.

OK.

Matthew


> ---
>  gcc/config/mips/mips.c                     | 10 ++++++++++
>  gcc/testsuite/gcc.target/mips/umips-attr.c | 13 +++++++++++++
>  2 files changed, 23 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.target/mips/umips-attr.c
> 
> diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index
> bf69850..959a672 100644
> --- a/gcc/config/mips/mips.c
> +++ b/gcc/config/mips/mips.c
> @@ -676,6 +676,9 @@ const char *mips_hi_relocs[NUM_SYMBOL_TYPES];
>  /* Target state for MIPS16.  */
>  struct target_globals *mips16_globals;
> 
> +/* Target state for MICROMIPS.  */
> +struct target_globals *micromips_globals;
> +
>  /* Cached value of can_issue_more. This is cached in
> mips_variable_issue hook
>     and returned from mips_sched_reorder2.  */  static int
> cached_can_issue_more; @@ -17182,6 +17185,13 @@
> mips_set_compression_mode (unsigned int compression_mode)
>        else
>  	restore_target_globals (mips16_globals);
>      }
> +  else if (compression_mode & MASK_MICROMIPS)
> +    {
> +      if (!micromips_globals)
> +	micromips_globals = save_target_globals_default_opts ();
> +      else
> +	restore_target_globals (micromips_globals);
> +    }
>    else
>      restore_target_globals (&default_target_globals);
> 
> diff --git a/gcc/testsuite/gcc.target/mips/umips-attr.c
> b/gcc/testsuite/gcc.target/mips/umips-attr.c
> new file mode 100644
> index 0000000..f8c4517
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/mips/umips-attr.c
> @@ -0,0 +1,13 @@
> +/* { dg-options "(-mmicromips)" } */
> +
> +int MICROMIPS
> +foo (int a)
> +{
> +  return a;
> +}
> +
> +int NOMICROMIPS
> +foo2 (int a)
> +{
> +  return a;
> +}
> --
> 2.2.2
> 


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