Question on PR26890, possible regression.

Jerry DeLisle jvdelisle@verizon.net
Tue Apr 11 00:37:00 GMT 2006


Jakub Jelinek wrote:
> On Fri, Apr 07, 2006 at 02:44:10PM -0700, Jerry DeLisle wrote:
> 
>>Thanks for the explanation. I will commit the fix to put pad back where it 
>>belongs shortly under the obvious rule.  I will also had a note explaining 
>>this connection back to the frontend.  I will check the size of the pad 
>>relative to the size of the other union to see where we stand.
> 
> 
> What you committed is not what I was looking for.

I committed that before your request for the compile time check came in.  I just 
had not time to get to it yet.

> u.pad really should be equal to what trans-io.c has compiled in and u.p
> should be smaller or equal to u.pad.
> Ok for HEAD (and similar change for gcc-4_1-branch)?

Your comment definitely states it better.  I tested the check code and of course 
it works.

Ok for trunk and 4.1.

> 
> 2006-04-10  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* io/io.h (st_parameter_dt): Revert 2005-12-10 change to
> 	u.pad, fix comment.
> 	(check_st_parameter_dt): New compile time assert.
> 
> --- libgfortran/io/io.h.jj	2006-04-10 14:00:31.000000000 +0200
> +++ libgfortran/io/io.h	2006-04-10 14:11:24.000000000 +0200
> @@ -436,13 +436,19 @@ typedef struct st_parameter_dt
>  	  char value[32];
>  	  gfc_offset size_used;
>  	} p;
> -      /* This pad size must be greater than or equal to the pad_size declared in
> -	 trans-io.c (gfc_build_io_library_fndecls)  */
> -      char pad[16 * sizeof (char *) + 34 * sizeof (int)];
> +      /* This pad size must be equal to the pad_size declared in
> +	 trans-io.c (gfc_build_io_library_fndecls).  The above structure
> +	 must be smaller or equal to this array.  */
> +      char pad[16 * sizeof (char *) + 32 * sizeof (int)];
>      } u;
>  }
>  st_parameter_dt;
>  
> +/* Ensure st_parameter_dt's u.pad is bigger or equal to u.p.  */
> +extern char check_st_parameter_dt[sizeof (((st_parameter_dt *) 0)->u.pad)
> +				  >= sizeof (((st_parameter_dt *) 0)->u.p)
> +				  ? 1 : -1];
> +
>  #undef CHARACTER1
>  #undef CHARACTER2
>  
> 
> 
> 	Jakub
> 



More information about the Gcc-patches mailing list