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]

-fpack-struct fix for gcc-2.95.2


Hi,

with gcc-2.95.2 the -fpack-struct command line parameter
is ignored.

The reason is, check_lang_option() in toplev.c didn't
check the complete independent options table, so the switch
was assumed to be a language depended one (-fpack triggered
this).

Here is a patch which fixes the problem for me:

--- gcc-2.95.2/gcc/toplev.c.org	Thu Oct 21 09:01:37 1999
+++ gcc-2.95.2/gcc/toplev.c	Sun Nov  7 02:55:43 1999
@@ -4683,7 +4683,8 @@
 {
   lang_independent_options * indep_options;
   int    len;
-  long    k;
+  int    numopts;
+  long   k;
   char * space;
   
   /* Ignore NULL entries.  */
@@ -4713,8 +4714,14 @@
   
   switch (option[1])
     {
-    case 'f': indep_options = f_options; break;
-    case 'W': indep_options = W_options; break;
+    case 'f':
+      indep_options = f_options;
+      numopts = NUM_ELEM (f_options);
+      break;
+    case 'W':
+      indep_options = W_options;
+      numopts = NUM_ELEM (W_options);
+      break;
     default:  return 1;
     }
   
@@ -4726,7 +4733,7 @@
   if (option[0] == 'n' && option[1] == 'o' && option[2] == '-')
     option += 3;
   
-  for (k = NUM_ELEM (indep_options); k--;)
+  for (k = numopts; k--;)
     {
       if (!strcmp (option, indep_options[k].string))
 	{


Please reply with cc to me, as I'm not on this list....

regards,
chris


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