[m68k] Fix option handling for -m68020-40 and -m68020-60

Gunther Nikl gnikl@users.sourceforge.net
Tue Oct 23 18:10:00 GMT 2012


Hello,

While working with GCC 4.7, I noticed that the -m68020-40 and -m68020-60
options are broken. This bug was introduced in May 2011 with the patch
at <http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02278.html>. The code
in m68k_option_override to set cpu and tune doesn't trigger when using
-m68020-40 and -m68020-60 since global_options_set is not touched by
the evaluation code for -m68020-40 and -m68020-60 in m68k_handle_option.
This patch was tested by checking the -dM output of a patched cc1 for
the present __mc680X0__ macros.


Regards,
Gunther Nikl

-- cut --
2012-10-23  Gunther Nikl  <gnikl@users.sourceforge.net>

	* common/config/m68k/m68k-common.c (m68k_handle_option): Set
	gcc_options fields of opts_set for -m68020-40 and -m68020-60.

-- cut --
Index: common/config/m68k/m68k-common.c
===================================================================
--- common/config/m68k/m68k-common.c	(revision 192718)
+++ common/config/m68k/m68k-common.c	(working copy)
@@ -33,7 +33,7 @@

 static bool
 m68k_handle_option (struct gcc_options *opts,
-		    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
+		    struct gcc_options *opts_set,
 		    const struct cl_decoded_option *decoded,
 		    location_t loc)
 {
@@ -45,12 +45,16 @@
     {
     case OPT_m68020_40:
       opts->x_m68k_tune_option = u68020_40;
+      opts_set->x_m68k_tune_option = (uarch_type) 1;
       opts->x_m68k_cpu_option = m68020;
+      opts_set->x_m68k_cpu_option = (target_device) 1;
       return true;

     case OPT_m68020_60:
       opts->x_m68k_tune_option = u68020_60;
+      opts_set->x_m68k_tune_option = (uarch_type) 1;
       opts->x_m68k_cpu_option = m68020;
+      opts_set->x_m68k_cpu_option = (target_device) 1;
       return true;

     case OPT_mshared_library_id_:
-- cut --



More information about the Gcc-patches mailing list