public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/6431: v850-elf-gcc, va_arg() fails in expanding arguments
@ 2002-04-23 11:16 markku.pihlajamaa
  0 siblings, 0 replies; only message in thread
From: markku.pihlajamaa @ 2002-04-23 11:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6431
>Category:       target
>Synopsis:       v850-elf-gcc, va_arg() fails in expanding arguments
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 23 11:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Markku Pihlajamaa
>Release:        gcc version 2.96-xscale-010827
>Organization:
>Environment:
GNU C cross compiler, configured for the v850-elf target, the compiler is run on a PC and the operating system is
Red Hat Linux 7.1.
>Description:
The first optional argument is not expanded by
va_arg() at all, but is skipped, and the last
optional argument is expanded to a random number.
>How-To-Repeat:
#include <stdarg.h>

extern int out ( int );

void test( int parc, ... )
{
    va_list list;

    va_start( list, parc );

    while( parc )
    {
        int i;

        i = va_arg( list, int );

        out( i );

        parc --;
    }

    va_end( list );
}


int main( void )
{
    test( 4, 1, 2, 3, 4 );

    return 0;
}
>Fix:
*** gcc/config/v850/v850.c.original	Sat Jan  8 10:15:57 2000
--- gcc/config/v850/v850.c	Tue Apr 23 13:55:30 2002
***************
*** 3653,3659 ****
    incr = build (MODIFY_EXPR, ptr_type_node, valist, incr);
    TREE_SIDE_EFFECTS (incr) = 1;
-   expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL);
  
    addr_rtx = expand_expr (addr, NULL, Pmode, EXPAND_NORMAL);
  
    if (indirect)
--- 3653,3660 ----
    incr = build (MODIFY_EXPR, ptr_type_node, valist, incr);
    TREE_SIDE_EFFECTS (incr) = 1;
  
    addr_rtx = expand_expr (addr, NULL, Pmode, EXPAND_NORMAL);
+ 
+   expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL);
  
    if (indirect)
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-23 18:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23 11:16 target/6431: v850-elf-gcc, va_arg() fails in expanding arguments markku.pihlajamaa

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