Patchwork fix darwin bootstrap

login
register
mail settings
Submitter Jack Howarth
Date Sept. 24, 2010, 12:40 a.m.
Message ID <20100924004002.GA1079@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/65610/
State New
Headers show

Comments

Jack Howarth - Sept. 24, 2010, 12:40 a.m.
The commit of r164532 broke the bootstrap on darwin in stage1
due to the incorrect passing to sizeof of a pointer to a struct
rather than the struct itself. The attached patch corrects this
error and restores the bootstrap on darwin. Bootstrap and
regression tested on x86_64-apple-darwin10. Okay for gcc trunk?
               Jack

2010-09-23  Dominique Dhumieres  <dominiq@lps.ens.fr>
	    Jack Howarth <howarth@bromo.med.uc.edu>

	PR 45751/target

	* gcc/config/darwin-driver.c: Pass struct to sizeof.
Richard Guenther - Sept. 24, 2010, 8:54 a.m.
On Fri, Sep 24, 2010 at 2:40 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>   The commit of r164532 broke the bootstrap on darwin in stage1
> due to the incorrect passing to sizeof of a pointer to a struct
> rather than the struct itself. The attached patch corrects this
> error and restores the bootstrap on darwin. Bootstrap and
> regression tested on x86_64-apple-darwin10. Okay for gcc trunk?
>               Jack

Looks obvious.

Thanks,
Richard.

> 2010-09-23  Dominique Dhumieres  <dominiq@lps.ens.fr>
>            Jack Howarth <howarth@bromo.med.uc.edu>
>
>        PR 45751/target
>
>        * gcc/config/darwin-driver.c: Pass struct to sizeof.
>
>
> Index: gcc/config/darwin-driver.c
> ===================================================================
> --- gcc/config/darwin-driver.c  (revision 164573)
> +++ gcc/config/darwin-driver.c  (working copy)
> @@ -76,7 +76,7 @@
>        generate_option (OPT_mmacosx_version_min_, macosx_deployment_target,
>                         1, CL_DRIVER, &(*decoded_options)[1]);
>        memcpy (*decoded_options + 2, argv + 1,
> -               (argc - 1) * sizeof (struct cl_decoded_option *));
> +               (argc - 1) * sizeof (struct cl_decoded_option));
>        return;
>       }
>   }
> @@ -128,7 +128,7 @@
>   generate_option (OPT_mmacosx_version_min_, new_flag,
>                   1, CL_DRIVER, &(*decoded_options)[1]);
>   memcpy (*decoded_options + 2, argv + 1,
> -         (argc - 1) * sizeof (struct cl_decoded_option *));
> +         (argc - 1) * sizeof (struct cl_decoded_option));
>   return;
>
>  parse_failed:
>

Patch

Index: gcc/config/darwin-driver.c
===================================================================
--- gcc/config/darwin-driver.c	(revision 164573)
+++ gcc/config/darwin-driver.c	(working copy)
@@ -76,7 +76,7 @@ 
 	generate_option (OPT_mmacosx_version_min_, macosx_deployment_target,
 			 1, CL_DRIVER, &(*decoded_options)[1]);
 	memcpy (*decoded_options + 2, argv + 1,
-		(argc - 1) * sizeof (struct cl_decoded_option *));
+		(argc - 1) * sizeof (struct cl_decoded_option));
 	return;
       }
   }
@@ -128,7 +128,7 @@ 
   generate_option (OPT_mmacosx_version_min_, new_flag,
 		   1, CL_DRIVER, &(*decoded_options)[1]);
   memcpy (*decoded_options + 2, argv + 1,
-	  (argc - 1) * sizeof (struct cl_decoded_option *));
+	  (argc - 1) * sizeof (struct cl_decoded_option));
   return;
   
  parse_failed: