This is the mail archive of the gcc@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]

Re: Resend: -fpack-struct again


On 6/11/99 21:33:46 Martin v. Loewis wrote:

>
>> On i686-pc-linux-gnu target (maybe others) gcc-2.95.2
>> doesn't honor the -fpack-struct command line switch.
>
>Thanks for your bug report. Interesting enough, I could not reproduce
>it on i586-pc-linux-gnu. For your example, the compiler generates

Hmm, thats weird. But I think I found the problem:

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))
 	{


regards,
chris


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