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]
Other format: [Raw text]

Re: RFA: new pass to warn on questionable uses of alloca() and VLAs


On Tue, 19 Jul 2016, Aldy Hernandez wrote:

> +      // Do not warn on VLAs occurring in a loop, since VLAs are
> +      // guaranteed to be cleaned up when they go out of scope.
> +      // That is, there is a corresponding __builtin_stack_restore
> +      // at the end of the scope in which the VLA occurs.

Given this ...

> +	    case ALLOCA_IN_LOOP:
> +	      warning_at (loc, wcode,
> +			  is_vla ? "use of variable-length array "
> +			  "within a loop"
> +			  : "use of %<alloca%> within a loop");
> +	      break;

 ... why is there a VLA case for this diagnostic at all?  I'd expect an 
assertion that only the alloca case can reach this diagnostic.

Also, if the format string for a diagnostic function is a ? : conditional 
expression you need to mark up each half with G_() so that both halves are 
properly extracted for translation.  This applies to lots of diagnostics 
in this patch.

-- 
Joseph S. Myers
joseph@codesourcery.com


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