public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] PR 62066: Call va_end on early return from va_list processing function
@ 2015-01-16 16:59 Kyrill Tkachov
  2015-01-16 17:26 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2015-01-16 16:59 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

Hi all,

As the simple PR says we should call va_end before returning early from 
a function that started processing the va_list with va_start.
The C spec agrees:
"Each invocation of the va_start and va_copy macros
shall be matched by a corresponding invocation of the va_end macro in 
the same
function."

Tested arm-none-eabi.

Ok for trunk?

Thanks,
Kyrill

2014-01-16  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR target/62066
     * config/arm/arm-builtins.c (arm_expand_neon_args): Call va_end before
     early return 0.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: arm-va_end.patch --]
[-- Type: text/x-patch; name=arm-va_end.patch, Size: 789 bytes --]

commit 6fe721142f9bbdd288a0d799e2d2d748899c06dc
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Wed Jan 14 16:06:00 2015 +0000

    [ARM] PR 62066: Call va_end in arm_expand_neon_args

diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 739369d..8268aa0 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -2049,7 +2049,10 @@ arm_expand_neon_args (rtx target, machine_mode map_mode, int fcode,
             case NEON_ARG_MEMORY:
 	      /* Check if expand failed.  */
 	      if (op[argc] == const0_rtx)
+	      {
+		va_end (ap);
 		return 0;
+	      }
 	      gcc_assert (MEM_P (op[argc]));
 	      PUT_MODE (op[argc], mode[argc]);
 	      /* ??? arm_neon.h uses the same built-in functions for signed

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][ARM] PR 62066: Call va_end on early return from va_list processing function
  2015-01-16 16:59 [PATCH][ARM] PR 62066: Call va_end on early return from va_list processing function Kyrill Tkachov
@ 2015-01-16 17:26 ` Ramana Radhakrishnan
  0 siblings, 0 replies; 2+ messages in thread
From: Ramana Radhakrishnan @ 2015-01-16 17:26 UTC (permalink / raw)
  To: Kyrill Tkachov, GCC Patches; +Cc: Richard Earnshaw



On 16/01/15 16:56, Kyrill Tkachov wrote:
> Hi all,
>
> As the simple PR says we should call va_end before returning early from
> a function that started processing the va_list with va_start.
> The C spec agrees:
> "Each invocation of the va_start and va_copy macros
> shall be matched by a corresponding invocation of the va_end macro in
> the same
> function."
>
> Tested arm-none-eabi.
>
> Ok for trunk?

OK.

Thanks,
Ramana

>
> Thanks,
> Kyrill
>
> 2014-01-16  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>       PR target/62066
>       * config/arm/arm-builtins.c (arm_expand_neon_args): Call va_end before
>       early return 0.
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-16 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 16:59 [PATCH][ARM] PR 62066: Call va_end on early return from va_list processing function Kyrill Tkachov
2015-01-16 17:26 ` Ramana Radhakrishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).